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 6865571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:04:15+00:00 2026-05-27T03:04:15+00:00

I have a XML file encoded in UTF-8. When I open it in Java,

  • 0

I have a XML file encoded in UTF-8. When I open it in Java, some(in theory valid) characters remain encoded. For example, I try to get the &#66352 character:

String str = new String(line.getBytes("UTF-8"));
System.out.println(str.charAt(pos));

where pos is the position where it should be.
I get instead the & character.

When I open it with Notepad++ and make sure it encodes UTF-8, I get the same problem.

To my mind, there should be two ways: getting from the beginning only codes(no characters) or replacing all codes with characters.

What should I do and how?

  • 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-05-27T03:04:15+00:00Added an answer on May 27, 2026 at 3:04 am
    1. Please don’t construct a String from a byte array without specifying a charset, thats alway a sign of a problem.

    2. if the charAt returns the ampersand character then you are either not using an xml parser to load the file or the character is double encoded like &66352;.

    3. The character 66352 won’t fit into Java’s 16 bit char datatype and so gets encoded as two surrogate characters in a String. You should use the codePointAt method in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have UTF-8 encoded XML file, which has Chinese characters. Questions are: Should I
I have an automatically-generated XML file that is supposed to be encoded with UTF-8.
I have some .xml files that are encoded in UTF-8 . But whenever I
I have an XML file, which I open in F# like this: let Bookmarks(xmlFile:string)
I have a XML File like that <?xml version=1.0 encoding=utf-8 ?> <Configurations> <EmailConfiguration> <userName>xxxx</userName>
I'm trying to read xml file from vbs script. Xml is encoded in utf-8
I have an XML document file.xml which is encoded in Iso-latin-15 (aka Iso-Latin-9) <?xml
I have a Java project that reads UTF-8 encoded .txt files in order to
I have some URL that contains special characters. For example: http://www.example.com/bléèàû.html If you type
I have some code that is reading a config file, but when I open

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.