aspose file tools*
The moose likes XML and Related Technologies and the fly likes Special Characters in XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Special Characters in XML" Watch "Special Characters in XML" New topic
Author

Special Characters in XML

L Goundalkar
Ranch Hand

Joined: Jul 05, 2001
Posts: 395
Hi,
How can i take care of special characters like meu ( dont know how to display the same here ) in XML.
what character set i have to set to my docuemnt object and how to set the same?
Thanks for the time.


<b>L G Goundalkar</b><br /> <a href="mailto:lggoundalkar@yahoo.com" rel="nofollow">lggoundalkar@yahoo.com</a> <br />Sun Certified Programmer for Java 2 Platform.<br />Sun Certified Web Component Developer for J2EE.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You need to replace the special characters with character references of the form &#nnnn; (for example, &#093; means "]").
You specify the document's character set with the XML declaration:
<?xml version="1.0" encoding="UTF-8"?>
[ November 06, 2003: Message edited by: Lasse Koskela ]

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
L Goundalkar
Ranch Hand

Joined: Jul 05, 2001
Posts: 395
Is there any method in DOM API to set the character encoding ?
Thanks.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Try this:
L Goundalkar
Ranch Hand

Joined: Jul 05, 2001
Posts: 395
Thats Nice.. Its working fine. Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Special Characters in XML
 
Similar Threads
XSD type: CDATA
Character encoding: Foreign characters not displayed correctly in XML and JSP
Getting attachment filename with special characters(JAVA MAIL API)
Exception in XML Parsing
Special characters converts to ? in Oracle 10g databse