But when I pa...">

UTF-8 does not work in HTML formats

I have this form:

<form method="post" enctype="multipart/form-data" accept-charset="UTF-8"> 

But when I pass the symbol Γ©, it turns it into Γƒ Β©.

Why is this not working? Yes, the MySQL database contains all character sets correctly configured. (Database, tables.) If I manually placed it in the database using Navicat, it displays well on the web page.

In addition, I tried the metatag, setting the title of the content type to no success.

+6
php mysql utf-8 character-encoding
source share
4 answers

In your HTML, add this meta tag:

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

Also add this PHP header at the top of the script:

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

[EDIT]:

Another tip is to save the file as UTF-8 without BOM . You can use Notepad ++ or any suitable editor for this.

+8
source share

Make sure you set the connection setting to utf8 :

 SET NAMES utf8 
+1
source share

There are several reasons for incorrect encoding, there is some help: http://www.sebastianviereck.de/en/php-mysql-special-characters-umlauts-utf8-iso/

0
source share

Add only accept-charset = "character_set" to the form

0
source share

All Articles