Pesky multibyte characters

A little tip picked up from Liam Foy Adrian Nida on #dragonflybsd on EFNet: If you have a 16-bit UTF file, cat and less will read it with ^@ characters all through the file. The pkgsrc package converters/recode will allow cleanup like so:

cat file.utf16 | recode utf16..ascii > file.ascii

Update: Several people pointed out that iconv can do the same thing.

2 Replies to “Pesky multibyte characters”

  1. Isn’t iconv installed by default? If so, that can be used instead of recode:

    cat file.utf16 | iconv -f utf-16 -t ascii > file.ascii

Comments are closed.