ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

XML encoding

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML encoding

    Hi all,

    I wonder if you can point me in the right direction here. I have a process to create some XML documents to be sent to an external application. In the main this works with UTF-8 encoding. I have an issue where some of my data genuinely holds special characters like the German Umlaut etc. This fails translation at the server end because it's not a valid UTF-8 character set.

    I've had a bit of a google but can't find anything that points me to the encoding that I should use? Does anyone have any suggestions?

    Thanks in advance

  • #2
    If you use the SQL functions for creating an XML-document it is automatically (per default) converted into UTF-8. No need to convert anything.

    Birgitta

    Comment


    • #3
      Originally posted by B.Hauser View Post
      If you use the SQL functions for creating an XML-document it is automatically (per default) converted into UTF-8. No need to convert anything.

      Birgitta
      Unfortunately I'm not and it's too late in the day to change it now, any other ideas? I've already added a process to escape my special characters, I could expand this to cover all special European characters but I don't want to if I can avoid it.

      Comment


      • #4
        How are you creating the XML?

        Comment


        • #5
          Hi Scott,

          We've got an RPG program that writes to work member, substituting variable names with database field values. We then copy the member to a streamfile and suffix it with ".xml".

          For example, I've got a file which defines my XML template..


          Code:
          <?xml version="1.0" standalone="no"?>                            
          <!DOCTYPE dcsmergedata SYSTEM "../lib/interface_sku_config.dtd"> 
          <dcsmergedata>                                                   
            <dataheaders>                                                  
              <dataheader transaction=£@SNDTYPE>                           
                <record_type>SKC</record_type>                             
                <config_id>£@CONFIGID</config_id>                          
                <depth_2>£@LENGTH</depth_2>                                
                <each_per_layer>£@LAYER</each_per_layer>                   
                <height_2>£@HEIGHT</height_2>                              
                <layer_height>£@LAYERHI</layer_height>                     
          ....
          My RPG program searches and replaces the "£@" variable names with the database values.

          Comment


          • #6
            I'm looking for details about how the data gets translated between character sets. All you've told us is "We then copy the member to a streamfile" which is a very broad desciption. Can you show us the exact code used to copy it?

            Comment

            Working...
            X