# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1343182535 0 # Node ID 9a32d4216f242baca4b43e26da3991b0cd47cb4a # Parent c5ea64e8b4367f2575e058a37337bac2a88988ac Make sure we set the locale on Mac and it is UTF-8. Otherwise the UTF-8/Wide conversions won't work. diff -r c5ea64e8b436 -r 9a32d4216f24 mac/dw.m --- 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 */