Hi,
I meet some problems when I write tests for ChrW, here are the tests:
1327 Call ok(ChrW(126) = "~", "ChrW(126) = " & ChrW(126))
1328 Call ok(AscW("~") = 126, "AscW(""A"") = " & AscW("A"))
1329 Call ok(ChrW(194) = "Â", "ChrW(194) = " & ChrW(194))
1330 Call ok(AscW("Â") = 194, "AscW(""Â"") = " & AscW("Â"))
and the results on testbot are:
run.c:1116: Test failed: api.vbs: L"ChrW(194) = \00c2"
run.c:1116: Test failed: api.vbs: L"AscW(\"\00c3\201a\") = 195"
On my Ubuntu system, UTF-8 is used as the default encoding. The unicode number for
"Â" is 0xc2, so the number is stored in utf-8 form as 0xc3201a with two bytes. However, vbscript use utf-16 as the default encoding, so 0xc3201a is interpreted as two independent characters whose unicode number are 0xc3 and 0x201a. AscW takes the first character and returns its unicode number 195.
My problem is, I can't figure out a way to write test codes with encoding utf-16, so the tests always fails on windows.
Thanks.