This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]