String a mess string

xiaoxiao2021-03-06  22

The article is useful for you.

Why do you have this kind of thing? Because these garbled corders are not the code page we use now (Simplified Chinese, GB2312). For the introduction of the code page, see "Code Support" in the MSDN2003.

How can I restore garbled to "original face"? What we have to do is to resolve the garbled string into a BYTE array, then re-encode it with the correct code page. How to get the correct code page? There is a table in the MSDN to introduce a code page and its corresponding integer value. For example, Simplified Chinese is 936, Traditional Chinese is 950, Japanese is 932, Korean is 949.

The code page in MSDN is: http://msdn.microsoft.com/library/chs/default.asp? Url = / library / chs / act / htm / actml_ref_scpg.asp

Here directly to an example of how the distortion reduction: Private Function ConvertTo (ByVal str As String) As String Dim ec As System.Text.Encoding = System.Text.Encoding.GetEncoding (CodePage) Return ec.GetString (System.Text. Encoding.default.getBytes (STR)) End Function

转载请注明原文地址:https://www.9cbs.com/read-56825.html

New Post(0)