site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thread-index: AcTFuZqEg5KvbSOOQfuN70uz6yN6Dg== 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 Robert.Buck@mathworks.com 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com