http://bugs.winehq.org/show_bug.cgi?id=16325
--- Comment #15 from Xiangrong Fang xrfang@gmail.com 2008-12-06 20:32:30 --- (In reply to comment #14)
We would like a test program that outputs PASS under Windows (without checking for OS version, of course). That will let us use it as a conformance test.
Can you improve your test to do that?
My test is a little dirty one. It relies on the font being used, hence returned FAIL on windows...
Huang, Zhangrong already discussed with Dmitry about this issue (#4065):
http://www.mail-archive.com/wine-devel@winehq.org/msg45989.html
According to Zhangrong, the problem is with GdiGetCodePage. However, I didn't find any windows equivalent of that function of MSDN. It seems is a Wine internal function. I think the following structure suggested by Zhangrong is a good solution:
(in GdiGetCodePage:) if (charset == ANSI_CHARSET || charset == DEFAULT_CHARSET) { cp = GetACP(); if (cp == 936 || cp == 950 || cp == .....) return cp;
else (TranslateCharsetInfo(....)) .... }
Dmitry commented that the above code will screw up fonts like russian under CJK locale, my comment is that practically no body will use russian on cjk windows... But, scientifically, I assume the following:
1) GdiGetCodePage is a Wine stuff, not Windows, so we have no "conformance" on this API, i.e. it has no windows counter-part which Wine need to stick to.
2) A LOT of Chinese program uses ANSI_CHARSET, and they intend to display Chinese Text, but not weird string of unreadable symbols. This is "de facto status" which Wine need to support, because Windows do.
3) If wine need to be perfect, i.e. display Russian for Chinese windows users (although I double how many percent of Chinese windows user will understand Russian), we can modify the above code to:
if (charset == ANSI_CHARSET) //we don't need to deal with DEFAULT_CHARSET { cp = GetACP(); if (IsOverridenCodePage(cp) return cp; else (TranslateCharsetInfo(....)) .... }
BOOL IsOverridenCodePage(UINT codepage) { /* this function read environment variable WINE_OVERRIDE_CODEPAGES, e.g.
env WINE_OVERRIDE_CODEPAGES=936,950
if code page is within the list, it returns TRUE, otherwise FALSE */ }
I think this will again makes the code EXACT same as current non-patched version, if the environment variable is not set.
What do you think?