Convert 1256 Code page ( iso-8859-1 ) to UTF8 in vb.net
علی ذوالفقار
1402/12/23 13:56:18 (146)
Function Convert_Bimeh_CodePage_To_UTF8(Input As String) As String
'// Convert iso-8859-1 to utf-8.
Dim UTF8_Encoding As System.Text.Encoding = System.Text.Encoding.UTF8
Dim ISO_Encoding As System.Text.Encoding = System.Text.Encoding.GetEncoding("iso-8859-1")
Dim ISO_Bytes As Byte() = UTF8_Encoding.GetBytes(Input_String)
'// Convert the bytes to utf-8
Dim UTF8_Bytes As Byte() = System.Text.Encoding.Convert(UTF8_Encoding, ISO_Encoding, ISO_Bytes)
Dim UTF8_String = Encoding.UTF8.GetString(UTF8_Bytes)
Return UTF8_String
End Function