DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23095>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23095

bug in Win32LCPTranscoder::transcode ?

[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|对中英文混合字符串|bug in
                   |持的不是很好        |Win32LCPTranscoder::transcod
                   |                            |e ?



------- Additional Comments From [EMAIL PROTECTED]  2003-09-11 11:53 -------
While I don't know what the summary and non-code text of this bug are (since it 
is undisplayable thus the change I am making to the Summary) I suspect it is 
related to the posting the xerces-c-dev mailing list titled "bug in 
Win32LCPTranscoder::transcode ?" from jiang lei which states:

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]

Reply via email to