XML with UTF-16 encoding

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf XML with UTF-16 encoding

  • Creator
    Topic
  • #50283
    Rick Martin
    Participant

      Is there a secret to getting an XML file with UTF-16 encoding to work in Cloverleaf?  I’ve tried a bunch of combinations of files with and without BOM (Byte Order Mark) characters and encoding attributes.

      I keep getting the “Fatal Error generated during parsing. – Invalid document structure” error.

      I’m assuming it is an encoding problem, since I can get a UTF-8 file to work just fine.

      Thanks, Rick

    Viewing 1 reply thread
    • Author
      Replies
      • #65462
        Robert Kersemakers
        Participant

          Hi Rick,

          Not sure if this helps, but we had an XML problem with UTF-8: a special character came in as a 2-byte character and this way a field would exceed it’s maximum length. Of course a mistake on the sending side, but no way to correct this on time at the sending side.

          So we converted the incoming XML from UTF-8 into ISO8859-1:

          Code:

          set msg [encoding convertfrom utf-8 [msgget $mh]]


          This way the 2-byte special character became a single byte character again (

          Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

        • #65463
          Anonymous
          Participant

            First and foremost: Cloverleaf only deals properly with encodings if you use the multi byte version (5.5MB or 5.6MB)

            If you don’t Cloverleaf will handle anything as if it was iso8859-1 regardless of what it actually is. I.e.: Cloverleaf is not encoding aware.

            You may want to have a look inside $HCIROOT/tcl/lib/tcl8…/encodings. Suppose you have utf-16 there, you should be able  to have the command Robert already gave you to convert to iso8859-1.

            ISO8859-1 is your only safe encoding in Cloverleaf unless you use the multi byte version.

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.