I've got a hta-script that saves values of text-inputs to a .txt file locally. That works great, with one exception: It saves the .txt file as ANSI - what I need to do is save it with UTF-8 charset.
Is there an easy way to do that?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<hta:application id="rndme"
applicationname="file saving test"
caption="yes"
showintaskbar="yes"
singleinstance="yes" />
</head>
<body>
<input type="text" id="data" name="data0" value="Titel" onfocus="this.value=''"></input>
<input type="button" id="button1" value="Speichern" onclick="save('titel.txt', data0.value ); alert('Trainer Name wurde erfolgreich gespeichert.');"/>
</div>
<script>
function load(filename) {
var fso, file, text;
fso = new ActiveXObject("Scripting.FileSystemObject");
file = fso.OpenTextFile(filename, 1, false);
//text = file.readAll();
file.Close();
return text;
} //end load()
function save(filename, strData) {
var fso, file;
fso = new ActiveXObject("Scripting.FileSystemObject");
file = fso.CreateTextFile(filename, 2, false);
file.write(strData);
file.Close();
return file;
}//end save()
function append(filename, strData) {
return save( filename , load(filename) + strData );
}//end append();
</script>
</body></html>