0

Information that I send to mysql with accents are appearing with strange chars, for example správce is admin in my language. And when I send this to mysql it appears like "správce".

Im trying to find information to solve this problem, and I saw two solutions, but any is working.

1st solution with meta tags, dont works:

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

2º solution with htmlspecialchars method also dont works

if($f['level_admin'] == '1') { $f['level_admin'] = htmlspecialchars('Správce', ENT_QUOTES, "UTF-8"); }
if($f['level_admin'] == '2') { $f['level_admin'] = htmlspecialchars('Super Správce', ENT_QUOTES, "UTF-8");}

Do you know some way that work effectively?

UserX
  • 1,295
  • 7
  • 25
  • 39
  • Have you checked the DB fields collation? If it's latin instead of utf8 then that's the first thing to check. – ffflabs May 01 '14 at 18:56
  • 1
    possible duplicate of [UTF-8 all the way through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – Marcus Adams May 01 '14 at 19:11
  • Yes it was latin amenadiel, but now I change for utf-8 but the problem continues! – UserX May 01 '14 at 19:55

1 Answers1

0

It's also important to know what collation is set in the MySQL DB Table - dependent on your needs you could use for example "utf8_unicode_ci" . There is also a php function that converts string to UTF8

utf8_decode() 
utf8_encode()

Normally this helps - but you better check the collation in the DB.

Kosha Misa
  • 341
  • 1
  • 3
  • 14