2 Replies - 344 Views - Last Post: 11 November 2012 - 03:42 PM Rate Topic: -----

#1 <aris>  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 24-August 11

Encoding Problem Maybe

Posted 11 November 2012 - 02:38 PM

Hello,

I've started, recently, a project for my job.

The problem I am facing now is that I prepared a post form to store some data to my mysql database. When I add the data manually with sql commands in phpmyadmin then Greek characters are showing correct while when I use my php page it won't store the data normal. It contains something like that:

πομοπμοπ -> utf8_general_ci (collation)
???????????????? -> greek_general_ci (collation)

My html meta charset is utf-8. My php file is utf-8, so I am guessing the problem is that php don't handle my data correct. Some encoding problem I think.

The problem is only with Greek characters!

Any help would be great!

Is This A Good Question/Topic? 0
  • +

Replies To: Encoding Problem Maybe

#2 Atli  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,991
  • Joined: 08-June 10

Re: Encoding Problem Maybe

Posted 11 November 2012 - 03:36 PM

Hey.

Two common things that cause problems like these are:

  • The encoding on the page with the form is incorrect. If the page with the form has an incorrect character encoding declared, the data will be mangled from the beginning, and it will likely never display correctly. Make sure that this page is using UTF-8.

  • The MySQL connection is not set up to handle UTF-8. By default, MySQL connections from PHP don't handle UTF-8 data correctly. You need to change the character encoding of the connection to handle such data properly. To do that, execute this command immediately after the connection to MySQL has been created in your PHP code.
    SET NAMES 'utf8';
    
    


If neither of those help, post your code here so we can take a look.
Was This Post Helpful? 2
  • +
  • -

#3 <aris>  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 24-August 11

Re: Encoding Problem Maybe

Posted 11 November 2012 - 03:42 PM

WOW! The second solution solved the problem! Thank you very much!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1