drkbl icon

UTF8 to ISO-8859-1

drkbl | PRO | 01/05/19 08:35:32 AM UTC | 0 ⭐ | 644 👁️ | Never ⏰ | []
C# |

320 B

|

None

|

0 👍

/

0 👎

/* https://stackoverflow.com/questions/1922199/c-sharp-convert-string-from-utf-8-to-iso-8859-1-latin1-h */
 
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);

Comments