Hi folks,
I noticed that there was a change in Win32LCPTranscoder between 2_1_0 and
2_3_0.
The old version uses mbstowcs() to calculate the buffer length while the new
version is using a new function called calcRequiredSize(const char* const
srcText). Inside calcRequiredSize(), mblen() is being used to get max
character size:
unsigned int Win32LCPTranscoder::calcRequiredSize(const char* const srcText)
{
if (!srcText)
return 0;
unsigned charLen = ::mblen(srcText, MB_CUR_MAX);
if (charLen == -1)
return 0;
else if (charLen != 0)
charLen = strlen(srcText)/charLen;
if (charLen == -1)
return 0;
return charLen;
}
I found that if the source string starts with multibyte character,
"transcode" in 2_3_0 will always fail. I tried calling setlocale(LC_ALL, "")
before transcode. It did change MB_CUR_MAX from 1 to 2. But mblen continued
to return -1 despite of my effort. The 2_1_0 version of transcode uses
mbstowcs() and it's working fine. Is that a bug of 2_3_0 or am I missing
something?
My environment is: Win2K Professional/VC++.Net2002 Standard (Both are
Japanese Edition)
Thanks for your attention.
regards
Lei
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]