Click to See Complete Forum and Search --> : Foreign character displaying from godaddy webhosting database


ketanco
07-01-2009, 06:53 AM
Hello,

I have web hosting with godaddy. I added another domain to my hosting account, but I am planning to make that new web page in a foreign language with soe different character letters of course. For just a static html page, the foreign letters are displayed correctly. However, when I try to update mysql database with foreign characters it didnt display them correctly. Even when updating the database it enters foreign characters wrong. Then I went into phpmyadmin of the database and tried all sorts of things such as changing the collation of the columns to foreign characters or changing the whole database connection collation to foreign character. On top of that, as the web form updating did not enter characters properly, I even manually pasted the correct form of characters into the table in phpmyadmin. Still the website can not display the correct characters from the table. I talked to godaddy and other than advising to change to connection collation, they said they can not hlep further and it is a scripting issue, and they said there are many foreign websites hosted with them. They said I should modify scripting in an htaccess file and they support that file type. Can anyone advise how to do that?

Erni
07-05-2009, 02:16 PM
You probably use php for you website. The problem is in script as it was told by godaddy support.
There is a thing called mysql charset, and it is setted up after script connects to mysql by running a query
$query = "set names 'utf8'";
or any other charset you need.


Also there still can be more problems in there. I bet if you manually put charachters into phpmyadmin - phpmyadmin displays them correctly, right?
So problem can be with html charset, try to use UTF-8

ketanco
07-05-2009, 04:59 PM
exactly....when i put in charcters in phpmyadmin, with the correct foreign characters, it displays them corectly in php myadmin...(in this case the charactes are turkish)....however...when i try to display these cells, which are displayed correctly in php my admin, on my website, the turkish characters do not show up correctly....i tried utf8 but it doesnt work though...i pasted this utf8 to the php file, which brings up the data from the mysql fatabase to the website...still it doesnt diaply the turkish characters correctly...

Erni
07-06-2009, 03:38 PM
Well, as you can see - phpMyAdmin, which is also a php website actually, do the correct job with your chars...so the problem is in your site and your scripts.
For me this task will take half an hour to handle, but I don't have this half an hour for you.
I will describe how it works:
php works with mysql, you should specify the character set in php-mysql for saving to db and for getting from db, and it should be the same, also, php outputs all he gets from mysql in some character set to html, the caracter set also must be the same. The most problem can be found in setting html charset, if you even set in meta tag of html - it might not be applied, why? server can have default charset in which it outputs the data, I have forced with this problem a lot in Russian or other Asian hostings, my admin side was in utf8 and public side was in certain charset of the region.
You can try to use ini_set() function for this but most often it will fail, so if you save data to mysql in some charset (utf8) you should get it from mysql in the same format, and if html charset is different - u should use mb_string_convert() function.

Hope you will find solution. if not - try to contact me via contact form on my website, I will help you with it...Do not contact me from start! try to figure it out by yourself :)

ketanco
07-09-2009, 07:47 AM
I tried to set it to utf 8 both on php output file after connection and also i tried to set the table or database itself to same characters but still didnt work.

Erni
07-10-2009, 04:16 PM
Found this in your website html
<meta http-equiv="Content-Type" content="text/html; charset=latin5_turkish_ci" />
latin5_turkish_ci - this is not html encoding, this is mysql terminology.

How do you put the data to database?

How do you get it from database?

And I can advise you to start learning from basics - some basic articles about php, mysql, and html

ketanco
07-10-2009, 06:10 PM
even if it was utf, the same thing happened though...Putting data into databas eand displaying from database are done with two php files which works fine with english characters. Here is what I did: Can you tell what is wrong below?

(below assume utf8 instead of latin5_turkish_ci, as you are saying it is not valid...still it doesnt work)

1-I changed the connection collation of the database to: latin5_turkish_ci

2-then I created a new table. I read from somewhere that only new tables created after this change gets affected by the change I do in #1.

3-On that new table, in php my admin, I went into operations tab and changed the collation of the table to latin5_turkish_ci (and all the columns are collated as latin5_turkish_ci)

4-I have two php files, one to update the database and the second one (lets say file2.php) shows info from the database. both files have something like this:

mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
mysql_select_db($dbname);

mysql_query("SET NAMES 'latin5_turkish_ci'");

5-in the main page file, which brings up the file2.php via a php include statement, i also have character declaration as:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


<head>


<link rel="stylesheet" type="text/css" href="css.css" media="all"/>

<title>............</title>
<meta http-equiv="Content-Type" content="text/html; charset=latin5_turkish_ci" />


(but i dont have this in file2.php that is onnly for bringing up info from database and included in the main page...or should i ?)