var adTypeBinary = 1;
var adTypeText = 2;
var bOverwrite = true;
var bAsASCII = false;
var oFS = new ActiveXObject("Scripting.FileSystemObject");
var sFiNa = "OPM_Mitarbeiter.csv";
var sFrom = "Windows-1252";
var sFFSpec = oFS.GetAbsolutePathName( sFiNa);
var oTo = new ActiveXObject( "ADODB.Stream" );
var sTo = "utf-8";
var sTFSpec = oFS.GetAbsolutePathName( sFiNa + "-utf8.txt" );
WScript.Echo("File name:"+sTFSpec);
if (oFS.FileExists( sTFSpec )) {oFS.DeleteFile(sTFSpec);};
var oFrom = new ActiveXObject( "ADODB.Stream" );
oFrom.Type = adTypeText;
oFrom.Charset = sFrom;
oFrom.Open();
oFrom.LoadFromFile(sFFSpec);
WScript.Echo(oFrom.Size + " Bytes in " + sFFSpec);
var oTo = new ActiveXObject( "ADODB.Stream" );
oTo.Type = adTypeText;
oTo.Charset = sTo;
oTo.Open();
oTo.WriteText(oFrom.ReadText());
WScript.Echo(oTo.Size + " Bytes in " + sTFSpec);
var adSaveCreateNotExist = 1;
WScript.Echo(sTFSpec);
oTo.SaveToFile(sTFSpec , adSaveCreateNotExist);
oFrom.Close();
oTo.Close();
WScript.Echo("Das Programm ist nicht abgestürzt");
Donnerstag, 28. Juni 2012
convert ANSI to UTF-8 using JavaScript
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen