Reputation: 403
We need to invoke some legacy APIs which expect String.valueOf('\246')
in order to work properly. Since the input is in the form of XML we were wondering what string to put in the XML file to match String.valueOf('\246')
.
Upvotes: 0
Views: 978
Reputation: 718738
It depends on the encoding you are using when you write your XML. If you are using UTF-8, then you can add a prolog like this:
<?xml version="1.0" encoding="UTF-8"?>
The XML parser should be able to read any properly encoded characters in any supported character encoding. Support for UTF-8 is mandatory for any XML parser.
The other approach is to use a numeric character entity reference. For example the Java char
with value \246
has hexadecimal value A6
... and hence we can represent it in an XML document as &x00A6;
If you are using Java XML APIs to generate the XML, this should all be taken care of for you.
Upvotes: 1