Highlighted
Super Contributor.
Super Contributor.
537 views

Convert UTF8

I'm getting a txt file but it comes in UTF8, and the accents are not being handled correctly

Information comes

Rua Antônio José Marques

But when I put it on Form it comes

RUA ANTôNIO JOSé MARQUES

How can I convert to Windows 1252

 -----------------------

Is it possible with this code?

Encoding iso = Encoding.GetEncoding("ISO-8859-1");
Encoding utf8 = Encoding.UTF8;
byte[] utfBytes = utf8.GetBytes(Message);
byte[] isoBytes = Encoding.Convert(utf8, iso, utfBytes);
string msg = iso.GetString(isoBytes);
--------------------

 

Estou recebendo um arquivo txt mas vem em UTF8, e os acentos não estão sendo tratados corretamente

A Informação vem

Rua Antônio José Marques

Mas quando coloco no Form vem

RUA ANTôNIO JOSé MARQUES

Como posso converter para Windows 1252

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.