Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:03:22+00:00 2026-06-04T13:03:22+00:00

I just don’t see through myself currently. This should be standard: I get an

  • 0

I just don’t see through myself currently. This should be standard: I get an XML with some UTF-8 characters, which i want to parse.

Here is an example:
<person><name>Nguyển Thị Ngân</name></person>

When I parse this with GWTs XMLParser and print out the name node value, then the characters are corrupted:

String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><person><name>Nguyển Thị Ngân</name></person>";

Document doc= XMLParser.parse(xml);

NodeList list = doc.getElementsByTagName("name");
for(int i = 0; i < list.getLength(); i++){
    System.out.println("XMLParser: " + list.item(i).getFirstChild().getNodeValue());
}
System.out.println("System.out: " + xml);

The output is:

XMLParser: Nguyá»n Thá» Ngân

System.out: <?xml version="1.0" encoding="UTF-8"?><person><name>Nguyển Thị Ngân</name></person>

which I interpret, that it the character mess has nothing to do with the printing via System.out.

What could be the problem here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:03:24+00:00Added an answer on June 4, 2026 at 1:03 pm

    I think the issue is as described by Thomas Broyer. It can’t be what chooban says because printing the raw XML works as expected. You could try to replace the unicodes with their XML escape codes:

    StringBuilder xmlEscaped = new StringBuilder();
    for(int i = 0; i < xml.length(); i++) {
       char c = xml.charAt(i);
       if (c < 127) {
         xmlEscaped.append(c);
       } else {
         xmlEscaped.append("&#" + ((int) c) + ";");
       }
    }
    Document doc = XMLParser.parse(xmlEscaped.toString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just don't get it, why this way of .focus callback is not working?
I just don't know why i get this error: 2010-10-28 16:32:29,925 ERROR [ache.commons.digester.Digester.error :1635]
this is a silly n00b question but i just don't get it to work.
This is a easy question,but I just don't get it. I want to detect
This is propably a farcical problem but I just don't see the reason for
I just don't understand how this is done. I've gone through several questions here
Honestly, I just don't get the following design decision in C++ Standard library. When
I just don't understand why in this case if I get rid of this
Have tried all the examples on this website I just don't see anything on
I think this is a reasonably easy question however I just don't get autoloading

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.