Мне нужно преобразовать строку в UTF-8 в С#. Я уже много раз пробовал, но никто не работает, как мне хотелось. Я преобразовал свою строку в массив байтов, а затем попытался записать ее в файл XML (какая кодировка - UTF-8....), но либо я получил ту же строку (не закодированную вообще), либо у меня есть список байт, который бесполезен.... Кто-то сталкивается с той же проблемой?
Изменить: Это часть кода, который я использовал:
str= "testé";
byte[] utf8Bytes = Encoding.UTF8.GetBytes(str);
return Encoding.UTF8.GetString(utf8Bytes);
В результате "testé" или я ожидал чего-то вроде "testà ©"...