UTF-8 not working in HTML forms

前端 未结 5 1291
失恋的感觉
失恋的感觉 2020-12-03 18:40

I have this form:

But when I submit an é character, i

相关标签:
5条回答
  • 2020-12-03 19:16

    Had the exactly same problem as mentioned above, tried everything mentioned. Try deleting enctype="multipart/form-data" and adding accept-charset="utf-8" from the tag. This was the solution in my case.

    0 讨论(0)
  • 2020-12-03 19:17

    In your HTML, add this meta tag:

     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    

    Also add this PHP header at top of the script:

     header("Content-Type: text/html;charset=UTF-8");
    

    [EDIT]:

    One more tip is to save the file as UTF-8 without BOM encoding. You can use Notepad++ or any decent editor to do that.

    0 讨论(0)
  • 2020-12-03 19:24

    Ensure you have set your connection collation to utf8:

    SET NAMES utf8
    
    0 讨论(0)
  • 2020-12-03 19:30

    Add only accept-charset="character_set" in form. It is all!

    accept-charset="character_set"
    
    0 讨论(0)
  • 2020-12-03 19:31

    there are a couple of reasons for the wrong encoding, there is some help: http://www.sebastianviereck.de/en/php-mysql-special-characters-umlauts-utf8-iso/

    0 讨论(0)
提交回复
热议问题