Html form set content type in requset header for charset utf-8

48 Views Asked by At

May be a basic question but I am struggling with it. Following it the HTML form on submitting the Content-Type:application/x-www-form-urlencoded without charset:utf-8. enter image description here

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Form with UTF-8</title>
</head>
<body>

<form action="/reporting" method="post">
    <!-- Form fields go here -->
    <label for="name">Name:</label>
    <input type="text" id="name" name="name">

    <label for="email">Email:</label>
    <input type="email" id="email" name="email">

    <input type="submit" value="Submit">
</form>

</body>
</html>

The problem I am facing is the parameter are not interpreted correctly if it's Japanese characters. If I modify the request using developer's tool and run with modified header which is charset:utf-8 from power shell the result is correct. Please let me know if anyone have any idea.

1

There are 1 best solutions below

0
Samuel On

i think the issue can be related to how its translating from the form try this in your form and mark this if it works , just try not saying it will but error could be coming from there, Goodluck :) add this in the tag of the form after method='post' accept-charset="UTF-8"