File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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.


SCJP, SCWCD
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, ] 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