Locale and strerror in libgcj's native code...

Bryce McKinlay mckinlay@redhat.com
Wed Aug 11 20:20:00 GMT 2004


David Daney wrote:
>In several places within the native code in libgcj, we have constructs
>like this:
>>throw new IOException (JvNewStringUTF (strerror (errno)));
>>or
>>throw new IOException (JvNewStringLatin1 (strerror (errno)));
>>According to my reading of the man pages, strerror returns a string
>according to the LC_MESSAGES encoding.
>>This means that the actual encoding is not known until runtime. So at
>compile time it is impossible to know which JvNewString* function to
>use. It seems to me that using a mix (as we currently do) is clearly
>wrong and only works in with ASCII encoding.
>>Perhaps we should have a JvNewStringLocale(const char *) that assumes
>the encoding is as specified by LC_MESSAGES.
>>For the time being, I am using JvNewStringUTF as that seems to be what
>my Fedora Core 1 system defaults to.
>>Most POSIX OS's seem to be standardizing on UTF8, so I think its fine to 
assume UTF8 in these places. We can always change this later if it turns 
out to be a problem.
Regards
Bryce


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /