MultiByteToWideChar fails in Vista (french) OS
-
Hi All, I am using the API 'MultiByteToWideChar' for converting the ASCII char buffer to unicode. This fails indefinitely on Windows Vista french OS. The API returns the number of characters converted. Below is the actual text: 'Carte réseau' After calling the API, the text returned is something like this: Carte r?seau Please provide your inputs on this. Thanks for your time. Regards
Sunil
-
Hi All, I am using the API 'MultiByteToWideChar' for converting the ASCII char buffer to unicode. This fails indefinitely on Windows Vista french OS. The API returns the number of characters converted. Below is the actual text: 'Carte réseau' After calling the API, the text returned is something like this: Carte r?seau Please provide your inputs on this. Thanks for your time. Regards
Sunil
BTW, forgot to mention, below are the parameters to the API: char Description[132] = {0}; char Description[132] = {0}; TCHAR szName[132] = {0}; . . . . int nLen = MultiByteToWideChar(CP_UTF8, 0, Description, -1, szName, SIZEOF_ARRAY(szName)); // nLen is around 30, the no. of chars copied
Sunil
-
Hi All, I am using the API 'MultiByteToWideChar' for converting the ASCII char buffer to unicode. This fails indefinitely on Windows Vista french OS. The API returns the number of characters converted. Below is the actual text: 'Carte réseau' After calling the API, the text returned is something like this: Carte r?seau Please provide your inputs on this. Thanks for your time. Regards
Sunil
This API works fine. The problem is your machine language may be set to English. So first set the machine language to French. Go to Control Panel->Regional and Language options In both "Regional Options" and "Advanced" tabs selct Frech language. It will ask you to reboot the machine. Reboot it and check now. It will work fine. Cheers, Sujeet Pandurang Kumbhar.
modified on Monday, May 25, 2009 2:20 AM
-
Hi All, I am using the API 'MultiByteToWideChar' for converting the ASCII char buffer to unicode. This fails indefinitely on Windows Vista french OS. The API returns the number of characters converted. Below is the actual text: 'Carte réseau' After calling the API, the text returned is something like this: Carte r?seau Please provide your inputs on this. Thanks for your time. Regards
Sunil
The accented e is a second, third, or fourth byte of a multi-byte sequence for a UTF-8 encoding and thus is invalid as a stand-alone character. You should likely use 1252 as the code page.
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
-
This API works fine. The problem is your machine language may be set to English. So first set the machine language to French. Go to Control Panel->Regional and Language options In both "Regional Options" and "Advanced" tabs selct Frech language. It will ask you to reboot the machine. Reboot it and check now. It will work fine. Cheers, Sujeet Pandurang Kumbhar.
modified on Monday, May 25, 2009 2:20 AM
"é" is an ANSI character (code page 1252), but doesn't have a single character representation in UTF-8. Please remove your answer because it is 100% wrong.
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
-
This API works fine. The problem is your machine language may be set to English. So first set the machine language to French. Go to Control Panel->Regional and Language options In both "Regional Options" and "Advanced" tabs selct Frech language. It will ask you to reboot the machine. Reboot it and check now. It will work fine. Cheers, Sujeet Pandurang Kumbhar.
modified on Monday, May 25, 2009 2:20 AM
-
The accented e is a second, third, or fourth byte of a multi-byte sequence for a UTF-8 encoding and thus is invalid as a stand-alone character. You should likely use 1252 as the code page.
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
Hello Thanks for your time. It is not only this character that is failing, but it definitely fails on Chinese/Japanese as well. Could you think of anything else ? Also i use a lenevo c200 system, one which i have encountered numerous string errors in my dev life :^) . Thanks
Sunil
-
Hello Thanks for your time. It is not only this character that is failing, but it definitely fails on Chinese/Japanese as well. Could you think of anything else ? Also i use a lenevo c200 system, one which i have encountered numerous string errors in my dev life :^) . Thanks
Sunil
You have to correctly identify the code page of the original string. You are not. If you have a multi-byte Japanese string using Shift-JIS, you need to use that, not UTF-8. The point is that UTF-8 is a very specific encoding, not just multi-byte in general.
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
-
You have to correctly identify the code page of the original string. You are not. If you have a multi-byte Japanese string using Shift-JIS, you need to use that, not UTF-8. The point is that UTF-8 is a very specific encoding, not just multi-byte in general.
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke