Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1002

bug in Win32LCPTranscoder::transcode ?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • Utilities
    • None
    • Operating System: Windows XP
      Platform: PC
    • 23095

    Description

      ç"¨XMLString对中英æ-‡æ- - 合字符串进行ç¼-码转换后再转åŒ-回来,有时会å'现字符串å°'了一截
      å½"字符串以英æ-‡å­—符(单字节字符)开始时一切正常
      å½"字符串以中æ-‡å­—符(双字节字符)开始时会丢掉尾部的部分字符

      将下面函数按下面æ-¹å¼ä¿®æ"¹åŽå°±å¥½äº†
      unsigned int Win32LCPTranscoder::calcRequiredSize(const char* const srcText)
      {
      if (!srcText)
      return 0;

      /* ä¿®æ"¹äºŽ2003-08-22
      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;
      */

      if(mblen(srcText,MB_CUR_MAX)==-1)return 0;
      unsigned charLen=mbstowcs(0,srcText,0);
      return charLen;
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            dragonzht@eyou.com 吴锦龙
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: