jimfog Posted November 10, 2011 Share Posted November 10, 2011 I have made a form which contains a textarea, where the user can leave a message there. This is to be passed in the database in a "message" column, of the text data type and of UTF8_general collation_ci. The message is not in English(it is in Greek), but in the db table the only thing i see is meaningless characters: Δεν Ï€Ïόκειται να ÎÏθω εδώ σÎ... As far as i know, utf8_general_ci is multilingual, so why the above problem appears? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 10, 2011 Share Posted November 10, 2011 If that's what is going to the database then it sounds like whatever is adding it to the database isn't receiving the correct text. Make sure all files involved are saved as UTF-8 files, and make sure each one uses a content type that also specifies UTF-8. Link to comment Share on other sites More sharing options...
jimfog Posted November 11, 2011 Author Share Posted November 11, 2011 Regarding the content type, i have set it to be, for every file utf-8: meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Regarding saving them in utf-8, i open the files with notepad and save them as UTF-8. But you are right saying that the problem is not with the database but with the code sending the data to it. Despite the above 2 actions the characters in the database appear still awkward. I do not know what else to try. I have a feeling that it is a matter of a small adjustment-but my mind goes until there. But you are right to say the the problem does not lie in the database but in the code sending the data to it. On second thought i am beginning to wonder whether the issue arises the i have not properly set doctype declaration, html xml:language etc... and all these info that appear at the top of a webpage. Maybe i should look into these to fix the issue. Link to comment Share on other sites More sharing options...
birbal Posted November 11, 2011 Share Posted November 11, 2011 are you using notepap or notepad plus plus . if its NPP the use convert to utf8 rather than save as utf-8and what about mysql connection collation? make sure it is utf-8 Link to comment Share on other sites More sharing options...
jimfog Posted November 13, 2011 Author Share Posted November 13, 2011 Still nothing, i saved the files as utf-8 with notepad ++ and the problem with the language still remains. I will have to check again from the beginning. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 14, 2011 Share Posted November 14, 2011 Note that changing these things is not going to change the data already in the database, you'll need to add new data to see if the changes worked. Link to comment Share on other sites More sharing options...
jimfog Posted November 14, 2011 Author Share Posted November 14, 2011 Note that changing these things is not going to change the data already in the database, you'll need to add new data to see if the changes worked. Yes i am aware of that. Despite my efforts so far, i have not managed to solve the issue. Link to comment Share on other sites More sharing options...
jimfog Posted November 16, 2011 Author Share Posted November 16, 2011 I took a different approach, I used mysql_set_charset('utf8',$db); where db: $db=mysql_connect('localhost','john','19891989','customers'); The problem now is that i get the following message: Fatal error: Call to a member function query() on a non-object in C:\xampp\htdocs\Appointments\Frontend\Proccesscustomers.php on line 42 Here what the code is in line 42: $result=$db->query($query); Maybe if I solve the above then the language issue will be solved. I assume there that must be a conflict between the object-oriented code in line 42 and the procedural one i useto connect to the database. I do not know how to solve the above issue though. Link to comment Share on other sites More sharing options...
Ingolme Posted November 16, 2011 Share Posted November 16, 2011 The mysql_connect() method doesn't return an object. You're setting a resource to $db and trying to use it like an object. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 16, 2011 Share Posted November 16, 2011 It sounds like you're confusing the mysql and mysqli extensions. Link to comment Share on other sites More sharing options...
jimfog Posted November 16, 2011 Author Share Posted November 16, 2011 Ok, i understood that, what code i must use when it comes to a resource, give me a link, if possible. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 16, 2011 Share Posted November 16, 2011 Check the manual for whichever extension you're using. http://www.php.net/manual/en/function.mysql-connect.phphttp://www.php.net/manual/en/mysqli.connect.php Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.