[XML-SIG] XML Unicode and UTF-8

"Martin v. Löwis" martin at v.loewis.de
Thu Aug 5 12:41:59 CEST 2004

n.youngman at ntlworld.com wrote:

> I'm trying to create an XML document, containing mostly ASCII, but
> potentially containing some unicode characters. I want to convert
> this all to UTF-8, but no matter what I try, I get an ASCII codec
> error.

It would be good if you had shown what precisely you have tried.

> I have tried using codec.open( filename, "w", "utf-8" )

This works fine for me.

> I have tried converting the unicode inline with string.encode(
> "utf-8").

This also.

> I have tried various combination of the above.

This is not a good idea.

> I have tried UTF-7

This is worse.

> What's the correct approach to this problem?

State all the information that you have, preferably in the form:
1. this is what I did
2. this is what happened
3. this is what I expected to happen instead.


More information about the XML-SIG mailing list