How to read files with different encodings using awk?

How can I correctly read files in encodings other than UTF8 in Awk?

I have a Hebrew / Windows-1255 encoded file. The simple {print $ 0} awk prints things like. how can i make it read correctly?

+5
source share
1 answer

Awk has no support for handling different encodings. It will respect the locale specified in the environment, but it is best to transcode the input into the correct encoding before passing it to awk.

-f - , , -t - , -c , iconv. --help .

iconv -c -f cp1255 -t utf8 somefile | awk ...
+6

All Articles