0

我在http://www.cwcenerji.com上安装了 osCommerce v2.2 RC2 。我的问题是关于左栏(categories.php)

在数据库中,我的类别名称是“Türkçe Categori”,但在前端我看到它像 T�rk�e Categori

我尝试了一些东西,我的数据库字符集也是 UTF-8 但无法处理。

这是categories.php;

<div class="title">
                    <img src="theme/images/icons/category.png" alt="Kategoriler"/>
                    <p>KATEGORİLER</p>
                </div>
                <div class="detail">

                    <ul class="categorytype">           








                <?php $query = mysql_query("select * from categories where parent_id = 0");
 $i = 0;
 while($row = mysql_fetch_array($query))
{
 $cat[$i] = $row;
$cat[$i]['categories_name'] = mysql_result(mysql_query("select categories_name from      categories_description where language_id = 1 and categories_id = '".$row['categories_id']."'"), 0);
$i++;
}

if(isset($session_id))
{
$cate = "&osCsid=$session_id";
}
else
{
$cate = "";
 }

 foreach($cat as $val)
 {
  //echo $val['categories_id'];
  $sub_query = mysql_query("select * from categories where parent_id = '".$val['categories_id']."'");
  echo '<li><a href="#">
                                <img src="theme/images/icons/stars.png" alt="Yıldız"/><span><b>'.$val['categories_name'].'</b></span></a>
                        </li>';

  while($sub_row = mysql_fetch_array($sub_query))
  {
  echo '<li><a href="#">
                                <img src="theme/images/icons/stars.png" alt="Yıldız"/><a href="kategori.php?cPath='.$val['categories_id'].'_'.mysql_result(mysql_query('select categories_id from categories_description where categories_id = '.$sub_row['categories_id'].' and language_id = 1'),0).$cate.'"><span>'.mysql_result(mysql_query('select categories_name from categories_description where categories_id = '.$sub_row['categories_id'].' and language_id = 1'),0).'</span></a>
                        </li>';
 }

 }

  ?>

4

2 回答 2

1

这是解决方案;

我在 categories.php 上添加了这些行(在

mysql_query("SET NAMES 'utf8'"); 
mysql_query("SET CHARACTER SET utf8"); 
mysql_query("SET COLLATION_CONNECTION = 'utf8_turkish_ci'");  
于 2013-08-29T14:28:06.643 回答
0

我在这些情况下使用 Notepad++。在记事本++中打开您的php文件并将其编码为从编码菜单中“将其转换为不带bom的utf-8”。外来字符可能会在第一时间被破解。转换进度后,您可以从文本编辑器将“T�rk�e”等字符更改为“Türkçe”。这可能会对您有所帮助。

于 2013-08-28T13:28:24.977 回答