Ask A Question
0

Get/set file content encoding with javascript

Asked by user1266681 on 09/16/2012 at 4:24 PM

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

View Full Answer On Stackoverflow

Responses

No responses yet. Be the first one!

    [Some content on this page is from Stackoverflow]