Re: iconv (libiconv.dylib) broken
Re: iconv (libiconv.dylib) broken
- Subject: Re: iconv (libiconv.dylib) broken
- From: Andreas Grosam <email@hidden>
- Date: Tue, 9 Feb 2010 22:52:43 +0100
On Feb 9, 2010, at 9:50 PM, Jonas Maebe wrote:
>
> On 09 Feb 2010, at 20:58, Andreas Grosam wrote:
>
>> after experimenting with the iconv library it seems that it is broken on Mac OS X.
>
> It works fine, but but you have to call setlocale(LC_ALL,"") before calling any iconv routines.
Unfortunately, this does not work for me.
setlocale(LC_ALL,"") will set the global "C" locale on my system, since the corresponding environment variables (LC_* and LANG) are not set.
Anyway, the POSIX global locale shouldn't have any effect in iconv. Iconv converts character strings from one specified locale to another specified locale and is thus independent on the POSIX locale which is always global for the process.
I should also mention, that I convert from the "WCHAR_T" locale to "UTF-8", in which case the conversion fails. The conversion is OK for UTF-32 to UTF-8, though. UTF-32 (UCS-4) is the internal format for wide characters in GNU C++. That is, a std::wstring internally uses UTF-32 (UCS-4) encoding.
> It is the same on Solaris (but not on Linux). My best guess is that the following statement from the POSIX spec justifies this behaviour:
>
> "Internationalised programs must call setlocale() to initiate a specific language operation."
>
> (from http://www.opengroup.org/onlinepubs/007908799/xsh/setlocale.html )
>
>
> Jonas _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden