Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

non-ascii charather printed out in a an xlm file

 
terry Kiernan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a task outputting to stdout where i then take this stdout and write it to an xml file , however i am getting non-ascii charather  appearing in the xml file .

I am placing all the stdout into CDATA but for some reason the above charather is been added to the xml file .

i am using PrintStream(systemOut)

Is there any way i can avid this from happening ???


any ideas/suggestion much appreciated !
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to filter the data you get from stdout so you only put valid characters into your XML document. The one you posted there can't be put into an XML document.

The XML Recommendation (obvious google keywords) contains a section which specifies what characters can and can't be put into XML.

Or if you don't want to filter out anything, you're going to have to do something to guarantee you only put in valid characters. Commonly people use Base-64 encoding to convert arbitrary binary data into text for that purpose, but you could do it in other ways too.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!