rbrunold Posted February 20, 2008 Share Posted February 20, 2008 Hello together ! I work on a application that should allow easy task automation from a central station for many different distributed systems. Therefor I create a web frontend based on php and a mysql in the background to do the administration tasks. I try to use some javascript / ajax functions as well to make it easy useable. Here comes the question: I created a input form where any kind of text or code can be entered. I send the content with ajax (encodeURIComponent encoded) in the POST part of a http request to a server side php script which stores it to the mysql which operates in utf-8 mode. I do no further encodings in php just write it to the database. Running some mysql selects shows me that everything is stored correctly in the db. When I use a php script to read contents from the mysql and show it in a table some characters are incorrect. I was searching a lot at google but I am confused know on how to decode this in php to show it correctly in the table. As far as I know (or think to know) php does not operate in utf-8 mode and that is the reason for that problem. Urldecode does not work because it also does not operate in utf-8 mode. Can somebody please point me on how I can do this ? Thanks a lot, Rainer Link to comment https://forums.phpfreaks.com/topic/92162-utf8-encoding-php-mysql-html/ Share on other sites More sharing options...
effigy Posted February 20, 2008 Share Posted February 20, 2008 See the doc in regards to: SET NAMES 'charset_name' SET CHARACTER SET charset_name Link to comment https://forums.phpfreaks.com/topic/92162-utf8-encoding-php-mysql-html/#findComment-472073 Share on other sites More sharing options...
aschk Posted February 21, 2008 Share Posted February 21, 2008 I believe the problem is just related to your html charset rather than anything else. Make sure you have <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> ... at the top of your pages. Link to comment https://forums.phpfreaks.com/topic/92162-utf8-encoding-php-mysql-html/#findComment-472607 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.