On 2/16/07, Justin Patrin <address@hidden> wrote:
> Running these commands over PuTTY on my Gentoo system (from Windows) gives me:
> address@hidden ~ $ echo "\xC2\xB7" | iconv -f UTF-8 -t
> CP1252//IGNORE//TRANSLIT
> \xC2\xB7
> address@hidden ~ $ echo "\xC2\xB7" | iconv -f UTF-8 -t
> ASCII//IGNORE//TRANSLIT
> \xC2\xB7
> address@hidden ~ $ echo "\xC3\x80" | iconv -f UTF-8 -t
> CP1252//IGNORE//TRANSLIT
> \xC3\x80
> address@hidden ~ $ echo "\xC3\x80" | iconv -f UTF-8 -t
> CP1252//IGNORE//TRANSLIT
> \xC3\x80
>
> Which I assume means that my shell is sending those strings in
> straight instead of making them UTF-8.
Bourne shells do not interpret C-style \-escapes in double-quoted
strings, and whether or not "echo" interprets them is extremely
system-specific. The "printf" shell builtin does interpret them,
though; try changing "echo" to "printf" and appending "\n" to all the
strings.
(Lapo: Please read up some on portability of Unix APIs at both the
shell and C level. You are assuming over and over again that things
which work on your personal Linux box work everywhere. It just isn't
so.)
zw