Mercurial > dwindows
changeset 1786:9a32d4216f24
Make sure we set the locale on Mac and it is UTF-8.
Otherwise the UTF-8/Wide conversions won't work.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 25 Jul 2012 02:15:35 +0000 |
parents | c5ea64e8b436 |
children | 6762e29938a2 |
files | mac/dw.m |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Wed Jul 25 00:46:00 2012 +0000 +++ b/mac/dw.m Wed Jul 25 02:15:35 2012 +0000 @@ -10547,6 +10547,8 @@ */ int API dw_init(int newthread, int argc, char *argv[]) { + char *lang = getenv("LANG"); + /* Correct the startup path if run from a bundle */ if(argc > 0 && argv[0]) { @@ -10588,6 +10590,10 @@ NSString *version = [[NSProcessInfo processInfo] operatingSystemVersionString]; const char *versionstr = [version UTF8String]; sscanf(versionstr, "Version %d.%d.%d", &DWOSMajor, &DWOSMinor, &DWOSBuild); + /* Set the locale... if it is UTF-8 pass it + * directly, otherwise specify UTF-8 explicitly. + */ + setlocale(LC_ALL, lang && strstr(lang, ".UTF-8") ? lang : "UTF-8"); /* Create the application object */ DWApp = [NSApplication sharedApplication]; /* Create object for handling timers */