in reply to Find illegal ASCII characters

Being nitpicky, but line 38 in original (quoted below) is NOT a general test for chars in 'ASCII text range':
if ( ($val < 32 && $val != 10 || $val > 126) ) {
as this misses some ASCII chars, such as 0x0d, that ARE in 'ASCII text range' at least as much as is 0x0a (10d).

Applicability of this nitpick depends on circumstances. Windows relies, for example on 0x0d, 0x0a for CR, LF (\n).