Jump to content

Problem With The Language


jimfog

Recommended Posts

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

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

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

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...