tags:

views:

32

answers:

1

hi everyone,

i have a web form written in asp.net that allows user enter content which is then saved to a DB and written out as an xml file for a third party to import into their systems.

We output the xml file as UTF-8.

They currently have a problem where a euro symbol (€) is breaking their xml parser with the following error:

parser error : Input is not proper UTF-8, indicate encoding !

From symbol looks ok to me but obviously as the user could be copying this symbol from any source when they copy it into my form it might not be UTF-8 encoded.

My questions:

1.) How do I know 100% if the euro symbol is UTF-8 encoded or not? Is there some editor where I can view it as UTF-8?

2.) Is there a way I can check a character when it is entered or pasted into the form to ensure it is saved as UTF-8 encoded?

Thanks everyone for your advice!

Ed

A: 

It sounds like you are taking the webform's submitted data and putting it in the XML as-is without validating it first. That is not a good idea. Alwyas validate your data before using it. Also, make sure the webform itself has a "charset=utf-8" attribute on it so that compliant browsers will transmit the data to the server in UTF-8.

Remy Lebeau - TeamB