Jump to content


Photo

[Solved] Issues with accents and strange characters in PHP/MySQL

accent special characters strange characters

  • Please log in to reply
2 replies to this topic

#1 orange77

orange77

    Rank I Member

  • Members
  • Pip
  • 34 posts

Posted 01 June 2020 - 05:53 PM

My website is in Brazilian Portuguese. And as you know, this is a language that uses special characters such as accents, cedillas, tildes, etc. And those characters are not being recogzined. I heard that something like this would solve:

 
ini_set('default_charset','UTF-8');
 
But even so, it didn't work out. My html is set as charset=utf-8. And nothing. My database is set as utf-8_general_ci, so are the tables in it. What solution can solve this problem?

Edited by orange77, 01 June 2020 - 06:21 PM.


#2 orange77

orange77

    Rank I Member

  • Members
  • Pip
  • 34 posts

Posted 01 June 2020 - 06:13 PM

If you're using PDO, just add this:

 

array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET CHARACTER SET utf8, NAMES utf8")

 

And it'll work fine.



#3 orange77

orange77

    Rank I Member

  • Members
  • Pip
  • 34 posts

Posted 01 June 2020 - 06:13 PM

If you're using PDO, just add this:

 

array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET CHARACTER SET utf8, NAMES utf8")

 

And it'll work fine.

Oh, Gosh. It worked. Thank you so, so much!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users