Incorrect results from BSD level libraries for nl_langinfo and locale C functions
Incorrect results from BSD level libraries for nl_langinfo and locale C functions
- Subject: Incorrect results from BSD level libraries for nl_langinfo and locale C functions
- From: "Robert Buck" <email@hidden>
- Date: Mon, 8 Nov 2004 12:37:22 -0500
- Thread-topic: Incorrect results from BSD level libraries for nl_langinfo and locale C functions
Context:
Mac OS X
Darwin 7.5
Functions:
nl_langinfo, locale
Problem:
Regardless of which language/locale I configure under the
internationalization settings in Mac OS X, nl_langinfo and locale always
return US-ASCII. If I were to write a Java program that called
java.lang.System.getProperty("file.encoding"), this returns SJIS when
the user language is configured as Japanese, but nl_langinfo and locale
functions continue to return US-ASCII.
Given a C/C++ software environment that: (a) links in Apple's JVM, which
itself (the JVM that is) determines the language/locale settings through
APIs such as GetApplicationTextEncoding or CFStringGetSystemEncoding,
and (b) also has BSD level libraries that try to determine the
locale/language settings via nl_langinfo and locale C functions, some
operations in said software environment results in incorrect results, or
introduces data corruption.
It has been said to me that, "Our [that is Apple's] BSD group is
investigating how to tie the BSD level into the higher-level
international support a little better. One possible approach would be to
have [BSD level libraries] get its default character set from an
environment variable (if present) which the higher-level software could
set. If you'd like to see this happen, please file a bug (it always
helps to have a request from a real developer)."
Questions:
[1] How can one configure the default charset, that is, configure the
native file encoding returned by nl_langinfo and locale, in OS X?
[2] How can BSD level libraries access the current user/application
default charset?
[3] Are there any work arounds that will work for BSD level libraries,
and applications, until the BSD group corrects the C libraries?
--------------------------------------------------
Robert Buck The MathWorks
email@hidden 3 Apple Hill Dr
www.mathworks.com Natick, MA 01760
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden