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.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)

Mentions

  • Adrian Nida
  • Anon