Problems escaping XML with Apache Commons StringEscapeUtils
posted 8 years ago
I've been trying to use the Apache commons StringEscapeUtils.escapeXml() to escape a string so that I can send it as an XML formatted request. The problem is that the characters between 128 and 255 all end up looking like: '�' in the escaped string. And since the string is supposed to be a filename, and that's "meaningless" in this context, the files end up not being found. In Python I use:
to escape the string, including quotes and apostrophes, but I can't seem to find a similar set of "utilities" for Java. Is there one?
Or is the problem simply a matter of character encoding?