duandao1931 2012-02-06 22:17
浏览 49

来自.mdb文件的希腊字符显示在本地计算机上,但不显示在Web服务器上

I've used the PHP function iconv() to convert greek text from an .mdb file from Windows-1253 to UTF-8 in order to display them on a website instead of having question marks. At first I succeeded while testing my script using XAMPP on my local machine and the greek text was shown properly in the browser. I also asked a question on how to do it here:

Cannot display Greek characters .mdb file (PHP & ODBC)

However, when I uploaded the website on my Godaddy's Windows server, the question marks reappeared. I tried removing the iconv() function to see if the results were different, and they were indeed different (different sort of encoding apparently but still question marks instead of proper greek characters). So, as far as I understand, the function iconv() works but the characters are not shown in the page. I tried using other browsers with no luck. The html charset is set to utf-8 in the headers. Could it be a problem with the hosting plan? The rest of the text in the page (mostly Greek) is shown properly apart from the text that is extracted from the database.

Any help would be appreciated,

Kyris

edit: php test code

<!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>

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

<title>Test Page</title>

</head>

<body>

<?php

require('access.php');

$temptype = 'Gardener';

$q = "SELECT TOP 1 ExpenseAccountGreek FROM ExpenseAccount WHERE ExpenseAccount = '$temptype'";

$r = @odbc_exec($dbc,$q);

$greektype[0] = @odbc_fetch_array($r);

$paymentsT[0]['Type'] = iconv('Windows-1253','UTF-8',$greektype[0]['ExpenseAccountGreek']);

echo $paymentsT[0]['Type'];

@odbc_close($dbc);

?>

</body>

</html>

  • 写回答

1条回答 默认 最新

  • duanmie9682 2012-02-06 22:59
    关注

    It may well depend on host, since if the server specifies a charset in HTTP headers, it overrides anything that you can say in your document. Check out the headers using e.g. http://www.rexswain.com/httpview.html

    评论

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程