从api结果解析时转换unicode情感字符(excel宏)

时间:2016-05-29 14:18:56

标签: excel vba excel-vba unicode excel-2010

在Excel中解析API结果后,我遇到了unicode字符问题。有许多表情符号,如表情符号和心形等。

它们看起来像\ud83d\ude09\ud83d\ude09\ud83d\ude09\ud83d\ude09,但我希望它们显示如下:

'这是我的代码

Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
objHTTP.Open "Get", URL, False
objHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE   6.0; Windows NT 5.0)"

objHTTP.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"

objHTTP.send


''objHTTP.Response.contentType = "text/xml"


strResult = objHTTP.ResponseText

strResult = Replace(strResult, "\u0026", "&", 1)

strResult = Replace(strResult, "\u011f", "ğ", 1)
strResult = Replace(strResult, "\u011e", "Ğ", 1)

0 个答案:

没有答案