How to encode 'á' to '&#225' with C# ?? (UTF8)

Posted by Llorens Marti on Stack Overflow See other posts from Stack Overflow or by Llorens Marti
Published on 2010-06-05T15:16:35Z Indexed on 2010/06/05 15:22 UTC
Read the original article Hit count: 195

Filed under:
|
|
|

Hi all

I'm trying to write an XML file with UTF-8 encode, and the original string can have invalid characters like 'á', so, i need to change these invalid characters to a valid ones.

I know that there is an encoding method that take, for example, character 'á' and transform it to group of characters 'á'.

I am trying to achive this with C#but i have no succes on it. I am using Encoding.UTF8 functions but i only end with the sema character (i.e: á) or a '?' character.

So, do you know with is the correct way to achive this character change with C# ??

Thanks for your time and help :)

LLORENS

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml