0

So the name has a weird smiley face in it that looks likes "ツ" In the database it is inputted as "ツ" I have already:

$username = utf8_decode($user);

Which displays the name as: utf-error

On the site, however the smiley face is still not showing.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Skent
  • 11
  • 2
  • 1
    Look into encoding your database, table, connection, file and PHP header with `utf8mb4` (where possible, `utf8` otherwise) charset. Then you don't need the `utf8_decode();` function. – Qirel Jul 08 '16 at 17:03
  • ツ is a Japanese character, but it's often used in things like ¯\\_(ツ)_/¯. Inuit characters with interesting shapes are also popular. Set your encoding to `utf8` or, as Qirel says, `utf8mb4` to properly capture emoji: – tadman Jul 08 '16 at 17:06
  • go to your phpmyadmin select your database, then select your table, then select your attribute, than change the collation it to utf8_general_ci – Aseem PM Jul 08 '16 at 17:13
  • @Aseem Collation is not the same as charset, and there are many more aspects of the line of code which needs to be set to the same charset. You're right though, that's once of the things - but just one of many :-) – Qirel Jul 08 '16 at 17:14

1 Answers1

0

Try this: header('Content-Type: text/html; charset=utf-8');

raviolican
  • 362
  • 4
  • 14