converting to wide characters

Andy Koppe andy.koppe@gmail.com
Sat Aug 8 20:48:00 GMT 2009


2009/8/8 Tony Lewis:
> According to the documentation, passing an empty string to iconv denotes
> locale dependent character encoding. This leads me to conclude that by
> default on cygwin:
>
> cd = iconv_open("UTF-16LE", "");
>
> should produce the same encodings as:
>
> cd = iconv_open("UTF-16LE", "ISO-8859-1");

Nope, the default codepage on Cygwin is your Windows' default "ANSI"
codepage, i.e. probably 1252.

> but it doesn't for characters in the range 0x80 to 0x9f. Is there a way to
> set my locale within cygwin so that "" means "ISO-8859-1" to iconv_open?

Cygwin 1.7's setlocale() reads the standard environment variables:
LC_ALL, LC_CTYPE, LANG. (On Cygwin 1.5 there's a codepage setting in
the CYGWIN variable, but I don't think that affects setlocale().)

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list