Sub Main()
Dim text As String = EncodeString("ä·Â") 'ไทย
End Sub
Function EncodeString(ByRef Str As String)
Dim latinEnc As System.Text.Encoding = System.Text.Encoding.GetEncoding("iso-8859-1")
Dim thaiEnc As System.Text.Encoding = System.Text.Encoding.GetEncoding("TIS-620")
Dim bytes As Byte() = latinEnc.GetBytes(Str)
Dim textResult As String = thaiEnc.GetString(bytes)
Return textResult
End Function
Function EncodeUTF8(ByRef Str As String) As String
Dim latinEnc As System.Text.Encoding = System.Text.Encoding.Default 'GetEncoding("TIS-620")
Dim thaiEnc As System.Text.Encoding = System.Text.Encoding.GetEncoding("UTF-8")
Dim bytes As Byte() = latinEnc.GetBytes(Str)
Dim textResult As String = thaiEnc.GetString(bytes)
Return textResult
End Function
ไม่รู้คุ๊กกี้เป็น TIS-620 หรืออะไร แต่ของผม work ทั้ง Default และ TIS-620