2 * On Windows, a Unicode argument is passed as UTF-16 using ShellExecuteExW.
3 * On other platforms, it is passed as UTF-8
6 static const int args_length
= 4;
7 #if defined(XP_WIN) && defined(_MSC_VER)
12 static const _TCHAR
* expected_utf16
[args_length
] = {
16 L
"\x41C\x43E\x437\x438\x43B\x43B\x430",
18 L
"\x9AE\x9CB\x99C\x9BF\x9B2\x9BE",
20 L
"\xD808\xDE2C\xD808\xDF63\xD808\xDDB7"};
22 int wmain(int argc
, _TCHAR
* argv
[]) {
23 printf("argc = %d\n", argc
);
25 if (argc
!= args_length
+ 1) return -1;
27 for (int i
= 1; i
< argc
; ++i
) {
28 printf("expected[%d]: ", i
- 1);
29 for (size_t j
= 0; j
< _tcslen(expected_utf16
[i
- 1]); ++j
) {
30 printf("%x ", *(expected_utf16
[i
- 1] + j
));
34 printf("argv[%d]: ", i
);
35 for (size_t j
= 0; j
< _tcslen(argv
[i
]); ++j
) {
36 printf("%x ", *(argv
[i
] + j
));
40 if (_tcscmp(expected_utf16
[i
- 1], argv
[i
])) {
51 static const char* expected_utf8
[args_length
] = {
53 "M\xC3\xB8z\xC3\xAEll\xC3\xA5",
55 "\xD0\x9C\xD0\xBE\xD0\xB7\xD0\xB8\xD0\xBB\xD0\xBB\xD0\xB0",
57 "\xE0\xA6\xAE\xE0\xA7\x8B\xE0\xA6\x9C\xE0\xA6\xBF\xE0\xA6\xB2\xE0\xA6\xBE",
59 "\xF0\x92\x88\xAC\xF0\x92\x8D\xA3\xF0\x92\x86\xB7"};
61 int main(int argc
, char* argv
[]) {
62 if (argc
!= args_length
+ 1) return -1;
64 for (int i
= 1; i
< argc
; ++i
) {
65 printf("argv[%d] = %s; expected = %s\n", i
, argv
[i
], expected_utf8
[i
- 1]);
66 if (strcmp(expected_utf8
[i
- 1], argv
[i
])) {