Convert debug_printf to take UTF-8 strings instead of wchar_t.

This fixes the problem where passing a non-ASCII string to
debug_printf(L"%hs", s) caused vswprintf_s to fail on Linux (because it
doesn't know what encoding the char* is meant to have). Now debug
messages will remain as UTF-8 until they reach the OS.

Fixes #3021.

This was SVN commit r16332.
This commit is contained in:
Ykkrosh
2015-02-14 01:45:13 +00:00
parent bf4b8bfe9c
commit e06a7b37d8
68 changed files with 232 additions and 229 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ bool print(JSContext* cx, uint argc, jsval* vp)
std::wstring str;
if (!ScriptInterface::FromJSVal(cx, args[i], str))
return false;
debug_printf(L"%ls", str.c_str());
debug_printf("%s", utf8_from_wstring(str).c_str());
}
fflush(stdout);
args.rval().setUndefined();