charaters from geoname UTF8 table display as latin1 - how to correct this?
Posted by: Ivan Gutschy
Date: March 10, 2011 03:29PM

Hi,

First to say that I am using Linux CentOS with Cpanel and MySql.

I have acquired geoname tables for countries and cities. They are set as utf8 tables. So I have imported them as utf8. most od other tables were created as default latin1.
And in phpmyadmin i see characters as they should be.

The problem is when i am displaying them on my website.
I have set
<code>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</code>
in my header. Other tables (the ones with latin1) are displaying characters correctly, alghough they are stored differently.

i have tried with
<code>
mysql_set_charset('utf8_general_ci',$dbc);
</code>
as well as
<code>
mysql_query("SET NAMES 'utf8'", $dbc);
</code>
but nothing changed.

this is block of code that selects countries and then cities based on country selection
<code>
$kveri="SELECT ccode FROM all_countries WHERE country_name = '$country_sel'";
$kveri_result = mysqli_query($dbc, $kveri);
$row=mysqli_fetch_array($kveri_result, MYSQLI_ASSOC);
$ccode=$row['ccode'];

$qc="select * from gradovi where ccode='$ccode' ORDER BY city ASC ";
$rc=mysqli_query($dbc, $qc);
// $rc = mb_convert_encoding($rc, "UTF-8");
$citys=array();
while($row=mysqli_fetch_array($rc, MYSQLI_ASSOC))
{
$ic=true;
foreach($citys as $k=>$value)
{
if($value==$row['city'])
{
$ic=false;
break;
}
}
if($ic)
{
$citys[]=$row['city'];
}
}
</code>

Any help is appreciated. I am not an expert programmer as you can see so I ask for your patience.

Thank you.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.