Watch command does not support ‘utf-8′ characters

This issue was found on Ubuntu 8.04 (Hardy Heron) Desktop.

If your coding in python and trying to write utf-8 encoded files, save yourself some time. The ‘watch’ command on Ubuntu Hardy does not display utf-8 characters when watching the contents of a file that contains them.

The file contents with the utf-8 character:

“This line shows a ‘»’ (Guillemot right) and a ‘®’ (Trademark sign).”

The command that doesn’t work:

watch cat /path/to/some/file.txt

Shows this:

Every 5.0s: cat file.txt 						Thu May 22 07:36:22 2008

"This line shows a '' (Guillemot right) and a '' (Trademark sign)."

The command that does work:

while true ; do cat /path/to/some/file.txt ; sleep 2 ; clear ; done

Shows this:

"This line shows a '»' (Guillemot right) and a '®' (Trademark sign)."

So if your learning proper encoding of utf-8 in python this does save you time when you’re troubeshooting your code .. :-)

GrtzG

Dit bericht is geplaatst in All ENGLISH articles, Technical met de tags , , . Bookmark de permalink.

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Verplichte velden zijn gemarkeerd met *

*

* Copy this password:

* Type or paste password here:

7,573 Spam Comments Blocked so far by Spam Free Wordpress

De volgende HTML tags en attributen zijn toegestaan: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>