6 Replies Latest reply on Jan 24, 2013 5:49 AM by tadayosi

    JBoss ESB messy code

    zhlwjy

      I translate csv to xml use smooks in Jboss ESB, when my csv file have chinese , then the xml result have messy code like this;

       

      the csv content:

      1,中国,101,test1,2012/2/25 0:00:00,10,123

       

      the message stdout:

      16:49:57,787 INFO  [STDOUT] [锘?,涓浗,101,test1,2012/2/25 0:00:00,10,123

      ].

       

      I export csv file use UTF8 ,then the messy code will appear , but when i use default (OS ansi code), the message will be OK.

      So, I must use char code that is same with OS ? how can I control the encoding of the char by myself?

        • 1. Re: JBoss ESB messy code
          zhlwjy

          I must have my custom action to change the encoding code of message content ? Is anyway to solve this problem without to coding?

          • 2. Re: JBoss ESB messy code
            tadayosi

            Hello,

             

            Did you set up the character encoding properly in the csv-to-xml smooks config?  This would be like below:

             

              <csv:reader ... encoding="..." />

             

            HTH

            • 3. Re: JBoss ESB messy code
              zhlwjy

              Hi Sato

              Thank you very much for your reply! use your methord ,I have right xml data.

              But I have another question:

              Can i control the encoding of the csv data which I read from csv file before i make csv to xml ?

              The esb read csv data to the message, this step ,can i do something ? because i print the csv data also have messy code !

              • 4. Re: JBoss ESB messy code
                zhlwjy

                Hi Sato

                 

                Another problem:

                the first char that also have messy code , and other data is ok !

                 

                the csv content:

                1,中国,101,test1,2012/2/25 0:00:00,10,123

                 

                the xml content:

                <ClassID>?1</ClassID><ClassName>中国</ClassName>.............

                 

                I use .net 2010 make the csv file with UTF-8,this error happend!

                But i make this csv file Manual in OS , then the data do not hava messy code !

                • 5. Re: JBoss ESB messy code
                  zhlwjy

                  I find that if i use UTF-8(false) to encoding the csv file ,then the data is OK.

                  I think that UTF-8 = UTF-8(true) in EBS, so <csv:reader ... encoding="UTF-8" /> can not be right to encode .

                  Thank you for sato to reply my question so kindly!

                  • 6. Re: JBoss ESB messy code
                    tadayosi

                    I guess your UTF-8 encoded CSV file had BOM (http://en.wikipedia.org/wiki/Byte_order_mark). Anyway, I'm glad to hear that you could solve the issue