0

-I've made a select input with options,
-I've given each option a value="something".
The problem is that in the database the submited value appears like "â€somethingâ€", instead of "something".
I've made research and I've putted :

$link= mysql_connect(DB_HOST, DB_USER , DB_PASS);
mysql_set_charset('UTF8',$link);

& already had:

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

In my database the collation is of type:"utf8_unicode_ci" for all columns

What is the problem then ?

  • I'm guessing that is a quote. May be caused by different encoding during write operations. – frz3993 Nov 11 '15 at 17:29
  • Is the table itself set to utf-8. See answer to this too : http://stackoverflow.com/questions/12984841/php-mysql-encoding-problems-%C3%A2-instead-of-certain-characters – PaulF Nov 11 '15 at 17:30
  • Could be due to your inserting/retrieving code or a copy and paste from some other character set. Can we see the code? – Phil Nov 11 '15 at 17:36
  • @Phil_1984_ which code , the HTML , or the PHP ? – Andrei Bularca Nov 11 '15 at 17:43
  • @PaulF I've applied the code answer in that question you sent me, same thing... – Andrei Bularca Nov 11 '15 at 17:45
  • @Phil_1984_ I've wrote the options in word and after that copy them in the editor, but my editor is set to UTF-8 encoding without BOM, so when I saved it, it overwrote the paste/encoding... that's not it -.- – Andrei Bularca Nov 11 '15 at 17:47
  • And what is the stupid thing is that a have 2 radio inputs with values and they also have underscore "_" and they are perfectly fine, and here a have only text and this appears: “— o.O – Andrei Bularca Nov 11 '15 at 17:52

2 Answers2

0

Most likely the data in your database was not written there in UTF8. So you are getting a mismatch of encodings.

Relevant SO question here: "’" showing on page instead of " ' "

Community
  • 1
  • 1
Dracony
  • 842
  • 6
  • 15
0

My bad,
I copied from Microsoft Word(because there is where I wrote the code ONLY TO ORDER IT ASCENDING BY LETTERS) plese don't BOOOOO!!!
So the code was like:

<option value=”something”>something</option>

the answer is:

"something"!=”something” ; " != ”

That was the problem :D

  • Yep so in the absence of any proper " those weird quote characters were considered part of the value data by the browser that submitted the data to the database. – Phil Nov 12 '15 at 16:59