I am struggling with the following problem. Using javascript I would like to change the character set of a file content and display this content to the user.
I have an input:file form. On change I am reading the content
$('#form input:file').change(function(event){
file = this.files[0];
reader = new FileReader();
reader.onload = function(event) {
result = event.target.result.replace(/\n/g,'<br />');
$('#filecontents').html(result);
});
reader.readAsText(file);
})
The file is in Windows-1251. I would like to convert the content of the file to another encoding and after that present it to the user.
Is this possible to achieve with javascript?
Regards