作者在 2017-07-15 00:19:46 发布以下内容
从网上找的,没测试有效性,先收藏了,说不定哪天用到
Private Function StringAsUtf8Bytes(ByVal str As String) As String
Dim utf8, gbk As System.Text.Encoding
utf8 = System.Text.Encoding.GetEncoding("utf-8")
gbk = System.Text.Encoding.GetEncoding("gbk")
Dim bytes() As Byte = gbk.GetBytes(str)
bytes = System.Text.Encoding.Convert(gbk, utf8, bytes)
Return utf8.GetString(bytes)
End Function