Encoding UTF8 string to ISO-8859-1 String (VB.NET)

后端 未结 5 1835
星月不相逢
星月不相逢 2020-12-11 22:11

I need to convert UTF8 string to ISO-8859-1 string using VB.NET.

Any example?


emphasized textI have tried Latin function and not runs. I recei

5条回答
  •  萌比男神i
    2020-12-11 22:44

    How about:

    Dim converted as Byte() = Encoding.Convert(utf8, Encoding.UTF8, _
                                               Encoding.GetEncoding(28591))
    

    That assumes that when you say "UTF8 string" you mean "binary data which is the UTF-8 representation of some text". If you mean something else, please specify :)

    Note that ISO-8859-1 only represents a tiny proportion of full Unicode. IIRC, you'll end up with "?" for any character from the source data which isn't available in ISO-8859-1.

提交回复
热议问题