http://bugs.winehq.org/show_bug.cgi?id=33447
--- Comment #17 from Ken Thomases ken@codeweavers.com 2013-04-29 13:31:30 CDT --- Hi Qian,
That approach does seem like it will help in this case, although, as you note, not in all cases.
You leak the objected created by CFLocaleCreateCanonicalLanguageIdentifierFromString(), though. In general, Core Foundation functions with "Create" or "Copy" in their names return an object that the caller is responsible for releasing.
Also, I wouldn't bother with the new user_locale_string_utf8_ref variable. Instead, just get the C string from user_locale_string_ref into user_locale and then strcat ".UTF-8" onto it.
Thanks for your work on this!