A
A
adam_carraway2018-10-18 21:06:01
JavaScript
adam_carraway, 2018-10-18 21:06:01

How to output text from csv in normal encoding?

When outputting a csv file to the screen, instead of Russian letters, some hieroglyphs.
Here is how I output:

function doSomething(id_input)
    {
        var file = document.getElementById(id_input);

        if(file.files.length)
        {
            var reader = new FileReader();

            reader.onload = function(e)
            {
                var result = $.csv.toArrays(e.target.result, {'separator':';'});
                console.log(result);
                var div = document.getElementById('user-name');

                div.innerHTML +=result;


            };
            reader.readAsBinaryString(file.files[0]);
        }
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Q
qq1, 2018-10-18
@adam_carraway

Try to use .readAsText, the second argument to the method takes the encoding
https://developer.mozilla.org/en-US/docs/Web/API/F...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question