I need to convert a string to UTF-8 in C#. I've already try many ways but none works as I wanted.I converted my string into a byte array and then to try to write it to an XML file (which encoding is UTF-8....) but either I got the same string (not encoded at all) either I got a list of byte which is useless....Does someone face the same issue ?
Edit :This is some of the code I used :
str= "testé";byte[] utf8Bytes = Encoding.UTF8.GetBytes(str);return Encoding.UTF8.GetString(utf8Bytes);
The result is "testé" or I expected something like "testé"...