T
T
tgkd2015-10-30 13:51:54
JavaScript
tgkd, 2015-10-30 13:51:54

How to determine the encoding of a javascript string?

There is an input to select a file. Get a string from a file in a script

var file = document.getElementById('upload').files[0];

I receive a line in which Russian letters are displayed not correctly.
mail;name;ТеÑÑ
How do I fix this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Nikolaev, 2015-10-30
@mccrush

1. Check the encoding of the file itself in which you write the script. Set utf-8 without BOM
2. Check the encoding in the browser. Put this one.
3. If you use a server (for example Apache), look at what is in the configuration file. Set it to utf-8.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question