html 个输入字段中的非拉丁字符

Non-Latin characters in html input fields

我遇到了非拉丁字符的问题。例如,如果我转到下面的 link 并输入“ü”并按提交,则会得到 %C3%BC 而不是该字母。我试过使用 content="text/html; charset=utf-8 ",但没有用。你们知道我该如何避免这个问题吗?

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_form_submit

提前致谢

你真的无法回避这个问题;此类字符的解码需要在服务器端进行。在 PHP 中 urldecode function is used for this, so urldecode('%C3%BC') returns 'ü'. This behaviour is part of the way that forms work - 如果您查看我用来提交此答案的 Stack Overflow 表单的代码:

<form id="post-form" action="/questions/37262431/answer/submit" method="post" class="post-form">

我可以使用字母 ü,但表单不包含任何额外的属性,因为服务器在将“ü”返回给客户端之前正在解码“%C3%BC”。