VB脚本BOM UTF-8编码文件删除BOM

时间:2023-01-06 07:31:11

I am using WinHttp.WinHttpRequest.5.1 to get back an xml document from a url. It has a "" at the start of the file causing XMLDOM.loadxml to fail.

我正在使用WinHttp.WinHttpRequest.5.1从网址获取xml文档。它在文件的开头有一个“”导致XMLDOM.loadxml失败。

Is there a way to

有办法吗?

  1. Remove the BOM from the string when reading from URL
  2. 从URL读取时从字符串中删除BOM
  3. Have the xml parser ignore the BOM
  4. 让xml解析器忽略BOM

(NOTE: I can't change the response from the URL)

(注意:我无法更改URL的响应)

1 个解决方案

#1


1  

Of course. You can clear the BOM at the beginning of the resulting string. I wrote for you this function. Pass a url as a argument and the function will return clean from BOM response. * have some problems when user try to post VBScript code. You can see function here: http://pastebin.com/mQysnW40

当然。您可以在结果字符串的开头清除BOM。我为你写了这个功能。传递一个url作为参数,该函数将从BOM响应返回清除。当用户尝试发布VBScript代码时,*会出现一些问题。你可以在这里看到功能:http://pastebin.com/mQysnW40

#1


1  

Of course. You can clear the BOM at the beginning of the resulting string. I wrote for you this function. Pass a url as a argument and the function will return clean from BOM response. * have some problems when user try to post VBScript code. You can see function here: http://pastebin.com/mQysnW40

当然。您可以在结果字符串的开头清除BOM。我为你写了这个功能。传递一个url作为参数,该函数将从BOM响应返回清除。当用户尝试发布VBScript代码时,*会出现一些问题。你可以在这里看到功能:http://pastebin.com/mQysnW40