Forum Stats

  • 3,815,465 Users
  • 2,259,031 Discussions
  • 7,893,110 Comments

Discussions

ASCII char issue in UTF-8

User_19BPU
User_19BPU Member Posts: 1,086 Blue Ribbon
edited Feb 9, 2018 12:12AM in Java Programming

Hi,

I am using XML with UTF-8 character encoding, there is a customer name which is in chinese char coming from DB is set as ASCII characters in the XML when we send this XML to another 3rd party. Please let me know why the ASCII char is displayed in XML with UTF-8 instead of chinese characters? Now to display chinese char in the XML which is already supporting UTF-8. Please clarify.

Thanks

Answers

  • Unknown
    edited Nov 4, 2017 12:42PM
    Please let me know why the ASCII char is displayed in XML with UTF-8 instead of chinese characters?

    It isn't possible to let you know WHY something is happening for you until you SHOW US:

    1. WHAT you do

    2. HOW you do it

    3. WHAT results you get

    4. WHAT results you expected to get.

    Strictly speaking NOTHING is 'displayed in XML' - XML is just a file/stream format. To display it you need to use some client tool such as an editor or browser. That tool can have many kinds of 'display issues' depending on the character set the tool is using and the characters in the data itself.

    Again - you didn't even mention what tool you are using to 'display' the XML. If you want to see EXACTLY what is in a file or byte stream use a HEX editor so you can see the actual byte representations.

    there is a customer name which is in chinese char coming from DB is set as ASCII characters in the XML

    Please explain how a 'chinese char' is 'set as ASCI'I.

  • 836548
    836548 Member Posts: 286
    edited Feb 9, 2018 12:12AM

    Prior any suggestion, you need to observe and inform us:

    1) What is DB character set ( Generally for Thai/Chinese it is a 2 byte character and charset will be "TIS620_UNICODE")?

    2) Are you reading the data from DB in UTF-8 charset?

    3) How you sending the XML to 3rd Party, and is 3rd party reading it in UTF-8 charset?

    4) As said in earlier post, xml is byte reader, you need an editor to read it and display it. By default the editors like Notepad++

    will identify the charset and show the values properly. if not,then there would be some change in charset, and you have to manually

    do it using Encoding option given in editor.

This discussion has been closed.