Sunday, August 11, 2019

utf-8 conversion in VBS script

this will read utf-8 in a while converting it for windows 1252 codepage

Source:
WScript.Arguments(0) contain the full path of the utf-8 file to convert

Destination:
strData

Set objStream = CreateObject("ADODB.Stream")

objStream.CharSet = "utf-8"
objStream.Open
objStream.LoadFromFile(WScript.Arguments(0))

strData = objStream.ReadText()

objStream.Close
Set objStream = Nothing

No comments:

Post a Comment