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

XMLUTF8Transcoder::transcodeTo fails with an exception when transcoding single characters that require 3 or more bytes as UTF8.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1.0, 3.1.1
    • 3.1.2, 3.2.0
    • Utilities
    • None
    • Tested on mac os and debian linux. The failure is only manifest on v3.1.x

    Description

      This can be demonstrated with the following 2 lines of code.

      const XMLCh uval [] =

      { 0x254B, 0x0000}

      ; //BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL (needs 3 bytes for utf-8)
      char* uc = (char*)TranscodeToStr(uval,"UTF-8").adopt(); cout << uc << endl << flush; XMLString::release(&uc); //faulty exception;

      The error is: "terminate called after throwing an instance of 'xercesc_3_1::TranscodingException'"

      Attachments

        1. TransService.cpp.patch
          5 kB
          Lee Doron
        2. TransService.patch
          1 kB
          Ben Griffin
        3. transtest.cpp
          0.7 kB
          Ben Griffin

        Issue Links

          Activity

            People

              amassari Alberto Massari
              mrthoughtful Ben Griffin
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: