Advertisement
drkbl

UTF8 to ISO-8859-1

Jan 5th, 2019
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.32 KB | None | 0 0
  1. /* https://stackoverflow.com/questions/1922199/c-sharp-convert-string-from-utf-8-to-iso-8859-1-latin1-h */
  2.  
  3. Encoding iso = Encoding.GetEncoding("ISO-8859-1");
  4. Encoding utf8 = Encoding.UTF8;
  5. byte[] utfBytes = utf8.GetBytes(Message);
  6. byte[] isoBytes = Encoding.Convert(utf8, iso, utfBytes);
  7. string msg = iso.GetString(isoBytes);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement