Oops! Somebody did broken it!

by Michael S. Kaplan, published on 2007/06/21 03:31 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/06/21/3438416.aspx

Some times, things get broken and nobody notices.

Other times, things have been broken for years and nobody noticed that, either!

As an example, back at the end of May, Arunaabh asked over in the microsoft.public.win32.programmer.international newsgroup:

In my application I am converting a string in one charset to other charset. I am using GetCPInfoEx() API to fill the CPINFOEX structure corresponding to the codepage number I am providing. I am using the following lines of code :

BOOL bNLS_Exist=GetCPInfoEx(nCodePage,0,&cpInfoEx);
DWORD err=GetLastError();

For nCodePage = 1147 which corresponds to charset 'ibm-1147' , GetCPInfoEx() returns me false even if it fills the CPINFOEX structure properly . The GetLastError() also returns zero. The corresponding nls file C_1147.nls is also present in the registry.

For nCodePage = 20949 which corresponds to charset 'X_CP20949' , GetCPInfoEx() returns me false even if it fills the CPINFOEX structure properly .

In this case GetLastError() returns with a value of '1814' which is "The specified resource name cannot be found in the image file" . The corresponding nls file C_20949.nls is also present in the registry.

Please help me out for the abrupt behaviour of GetCPInfoEx() API for the above two cases.

What can I say, Arunaabh is right.

Code page 20949 appears to have been failing for years (I could not get it to work on XP or Server 2003 or Vista. The GetCPInfo() pieces all work, but the string is not there (which actually explains the 1814 error, since the resource couldn't be found.

Now code page 1147 appears to be a more recent break -- it fails on Vista just as Arunaabh described, but on prior versions it used to work.

Someone should probably get a bug or two in to add a string and to figure out why the function is failing to show a string that is there that it used to load....


This post brought to you by (U+0dc5, a.k.a. SINHALA LETTER MUURDHAJA LAYANNA)

Mihai on 21 Jun 2007 4:35 AM:

Actually, noticed so long ago, that somehow I got used to it and did not complain :-)

On XP SP2 with all the possible i18n support installed, there are 4 code pages that fail: 1047, 1146, 1148 and 20949.

Michael S. Kaplan on 21 Jun 2007 5:54 PM:

Well, probably worth fixing at some point, I think....

Watches on 22 Jun 2007 12:05 AM:

Yes but when is it going to be fixed???

go to newer or older post, or back to index or month or day