Thanks Jim,
1. I agree. I'm learning to trust that nagging "I really shouldn't be doing this" feeling.
2. I see what you're suggesting, but I don't think this solves my problem, unless I've misunderstood the problem. When I create the XML I want to send, doesn't only the content of the tags need to be encoded, and not the tags themselves? If, for example, I want to send
in my XML, don't I only have to run "+44 121-534-8707" through the encoder?
If this is right, then I run into a new problem with using the OutputStreamWriter - how do I append the encoded byte array that it produces to the StringBuffer that is building my XML?
Oh, and just to add to the fun, I'm restricted to JDK 1.1.8, so I can't use the java.nio.Encoder class & related methods.
I've come up with this as a way to do this:
but it has the disadvantage of encoding every character, even the low ASCII values that are valid, which destroys the readability of my XML. On the other hand, it will be (should be) reconstructed by the receiving machine, so this shouldn't be a problem.
Am I on the right track?
Thanks
Dave