S
S
Stanislav Nekrasov2018-08-28 00:42:06
HTML
Stanislav Nekrasov, 2018-08-28 00:42:06

Why is the form submitting data in the wrong encoding?

File code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Регистрация</title>
</head>
<body>
    Регистрация<br>
    <form accept-charset="UTF-8" class="reguser" action="auth" method="POST">
        <input style="display: none;" type="text" name="type" value="reguser">
        Имя: <input type="text" name="firstname"><br>
        Фамилия: <input type="text" name="lastname"><br>
        Логин: <input type="text" name="login"><br>
        Пароль: <input type="password" name="password"><br>
        <input type="submit" value="Зарегистрироваться">
    </form>
</body>
</html>

When submitting the form, on the server (Java Servlet) Russian letters are displayed incorrectly.
When sending a POST request on my own, everything is fine.
All files are UTF-8 encoded.
What to do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Nekrasov, 2018-09-03
@Metalofon

In general, the problem has not been completely solved, but I partially solved it by sending the form using the GET method.

R
Rsa97, 2018-08-31
@Rsa97

And why do you think that the data is incorrectly sent? Maybe they are incorrectly received by the server? See in the browser console what exactly goes to the server. For HTTP, you can see through tcpdump or wireshark what exactly comes to the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question