Detect Non-ASCII Characters in Text Files

The grep utility can be used to detect non-ASCII characters in text files, e.g. in programming code:

LANG= grep --color='auto' -P -n '[^\x00-\x7F]' *.c *.h


:!: Please note the LANG= term used above overrides the localization / language configured for the console. There have been cases where the grep command didn't work as expected if a specific localization was configured.


Martin Burnicki martin.burnicki@burnicki.net 2019-04-26