我想获得一个字符的 UTF-8 代码,尝试使用流,但它似乎不起作用:
示例:根据https://en.wikipedia.org/wiki/Pe_(Semite_letter)#Character_encodings ,פ 应该给出 16#D7A4
Const adTypeBinary = 1
Dim adoStr, bytesthroughado
Set adoStr = CreateObject("Adodb.Stream")
adoStr.Charset = "utf-8"
adoStr.Open
adoStr.WriteText labelString
adoStr.Position = 0
adoStr.Type = adTypeBinary
adoStr.Position = 3
bytesthroughado = adoStr.Read
Msgbox(LenB(bytesthroughado)) 'gives 2
adoStr.Close
Set adoStr = Nothing
MsgBox(bytesthroughado) ' gives K
注意:AscW 提供 Unicode - 而不是 UTF-8