Prev: Remote reboot
Next: Delete Printer
From: Bob Hairgrove on 12 Sep 2005 18:06 On Mon, 12 Sep 2005 23:07:09 +0200, Bob Hairgrove <invalid(a)bigfoot.com> wrote: >const wchar_t MyRussianText [] = { > &x0417, &x0434, &x0440, &x0430, &x0432, &x0441, &x0442, &x0432, > &x0443, &x0439, &x0442, &x0435, &x002C, &x0020, &x0442, &x043E, > &x0432, &x0430, &x0440, &x0438, &x0449, &x0021, 0 }; oops ... too late at night, too much HTML code, too much cut & paste <g> ... This should be, of course: const wchar_t MyRussianText [] = { 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, 0x0439, 0x0442, 0x0435, 0x002C, 0x0020, 0x0442, 0x043E, 0x0432, 0x0430, 0x0440, 0x0438, 0x0449, 0x0021, 0 }; [snip] > >(e) Staying in column mode, cut and paste the high bytes where they >should belong and add the "&x" bits and commas to make them look like >the above example. Don't forget to add a trailing null byte, though! And this one, too: add the "0x" bits ... -- Bob Hairgrove NoSpamPlease(a)Home.com
From: Floptimize on 13 Sep 2005 08:45 This the sample code I worked with...: char szUTF8[MAX_PATH + 1]; TCHAR szfn[MAX_PATH + 1]; _tcscpy (szfn, _T("E:\\tmp\\Hungarian\\bflõuzáékötyy.tga")); WideCharToMultiByte (CP_UTF8, 0, szfn, _tcslen(szfn) + 1, szUTF8, MAX_PATH, NULL, NULL); hf = CreateFileA (szUTF8, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); // FAILS With error 2 hf = CreateFileW ((LPTSTR)szUTF8, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); // FAILS With error 3 hf = CreateFile (szfn, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); // FAILES With error 2 Certainly CreateFileW with a cast can't be correct... Ideas?
From: Floptimize on 13 Sep 2005 08:54 Bob, I also read your addendums to this post. I appreciate and fully comprehend your suggestions and tips, however I just can't see how this can lead into a practical approach to suit my needs. I'll give it some more thought. Thanks.
From: Bob Hairgrove on 13 Sep 2005 15:35 On 13 Sep 2005 05:54:25 -0700, "Floptimize" <bikermike(a)gmail.com> wrote: >Bob, > >I also read your addendums to this post. I appreciate and fully >comprehend your suggestions and tips, however I just can't see how this >can lead into a practical approach to suit my needs. > >I'll give it some more thought. > >Thanks. That's OK. But you'll just have to accept two things, at least: (1) The Windows API functions do NOT understand UTF-8; (2) The MSVC++ 6.0 source code editor (and presumably the compiler) does NOT understand Unicode text entered literally; (3) The file name might look like it has the correct characters, but actually they are not. I'll expand a little on this last point. Some Hungarian characters might LOOK like characters in the Western (i.e. ISO-8859-15) character set, but might have a different code point (i.e. numeric code equivalent) in the ANSI code page containing the extra letters of the Hungarian alphabet. For example, is "ý" (German "o wth Umlaut") the same character as the Hungarian "ý"? There are also the other characters with what I call "double accents" which might look like an Umlaut to most persons with no command of the Hungarian language (such as myself) but have no corresponding character in the Western code page. That was probably not such a good example. Let me try again, this time with Russian. Another example would be the letter "A", for example; in the Windows code page for Russian/Cyrillic (1251?) there are TWO characters with exactly the same glyph: the Western letter "A", and the Russian letter "A". They LOOK exactly the same, but if the file name you are trying to open is written (by mistake?) with a Latin character, but not the true Russian character, there will be no match. Hope you can eventually get this sorted out! It's not easy, that's for sure. -- Bob Hairgrove NoSpamPlease(a)Home.com
From: Floptimize on 14 Sep 2005 12:08
Thanks for following up. You have confirmed what I have observed in my experiments, and now its all coming together for me. Now its clear our problem is rooted in the lowest levels of our code base of which we have been working on for 4 years. This is ugly. Thanks for all your input. |