summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtchang%redhat.com <devnull@localhost>2006-07-14 22:13:42 +0000
committerwtchang%redhat.com <devnull@localhost>2006-07-14 22:13:42 +0000
commite55e7be804ac6067dbc366992135c45dbbe34413 (patch)
tree93c0b4187c45496d595b6473c2f3b15322a59187
parent509bfb642f5a7f9cb77cf579b4ce1a8d623f6510 (diff)
downloadnspr-hg-e55e7be804ac6067dbc366992135c45dbbe34413.tar.gz
Bugzilla Bug 326168: Windows NT 3.51 doesn't support CP_UTF8 either, so
having Unicode support doesn't imply having CP_UTF8 support. The patch is contributed by neil@parkwaycc.co.uk <neil@httl.net>. r=wtc,darin a=mtschrep Tag: MOZILLA_1_8_BRANCH
-rw-r--r--pr/src/linking/prlink.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c
index 51bff2b8..7fb06b78 100644
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -1160,11 +1160,15 @@ static int pr_ConvertUTF16toUTF8(LPCWSTR wname, LPSTR name, int len)
int utf8Len = 0;
PRBool highSurrogate = PR_FALSE;
- /* Windows NT4/2k/XP supports CP_UTF8. So do Win 98/ME, but
- * we don't bother to optimize for them. */
- if (_pr_useUnicode)
- return WideCharToMultiByte(CP_UTF8, 0, wname, -1, name, len,
- NULL, NULL);
+ utf8Len = WideCharToMultiByte(CP_UTF8, 0, wname, -1, name, len,
+ NULL, NULL);
+ /*
+ * Windows 95 and NT 3.51 don't support CP_UTF8.
+ * WideCharToMultiByte(CP_UTF8, ...) fails with the error code
+ * ERROR_INVALID_PARAMETER on Windows 95 and NT 3.51.
+ */
+ if (utf8Len || GetLastError() != ERROR_INVALID_PARAMETER)
+ return utf8Len;
if (!wname || len < 0 || (len > 0 && !name)) {
SetLastError(ERROR_INVALID_PARAMETER);