word / excel中的vba返回错误的字符集

时间:2015-09-15 11:05:38

标签: excel vba word-vba

我正在努力让我的代码显示æøå。

contentType = "application/x-www-form-urlencoded; charset=utf-8"

Set O = New HTMLDocument
Set objRequest = CreateObject("MSXML2.XMLHTTP")       'CreateObject("MSXML2.ServerXMLHTTP") '

With objRequest
   .Open "POST", my_url, False
   '.setRequestHeader "Content-Type", contentType
   .setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1"
   .send
End With

O.body.innerHTML = objRequest.responseText
Debug.Print O.body.innerHTML

这是输出 348,Kim Sk?n,KS,0, 本应该是Skåtun

如果我在IE中打开它(显示正确)并查看源代码我得到了:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>Logg skjema Ansatt liste</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<html>
<body>
348 , Kim Skåtun , KS , 0 , <br>


</body>
</html>

我也试过utf-8同样的结果,任何想法如何用vba解决这个问题?

0 个答案:

没有答案