dongyang9813 2014-07-29 23:07
浏览 63
已采纳

数据库表行包括在网页上无法正确显示的波斯语字符

I've connected my php webpage to my .mdb database via odbc connection.

My first question is:

What should I do to avoid ???? instead of proper Persian characters, when displaying my db table rows on the page.

My sample html code:

<form action="" method="post">
    <input type="text" value="my_value">
</form>

My sample PHP code:

<?php

$conn = odbc_connect('my_db','','');
if (!$conn) {
    exit("Connection Failed: " . $conn);
}

$submitted_value = $_POST["my_value"];
$sql = "SELECT * FROM my_table WHERE column1 = '$submitted_value'";
$result = odbc_exec($conn,$sql);
odbc_close($conn);

?>

My charset is already set to UTF-8 in php.ini.

And my second question is: (which I think might be because of the above problem):

When I type Persian in the html input value tag (instead of "my_value") and already have a row with exactly the same value in column 1, nothing is returned.

But When I change both value tag name and column 1 value of the table row to English. The result is returned.

Can anyone help me with this? I appreciate in advance.

  • 写回答

1条回答 默认 最新

  • doumeng4400 2014-07-29 23:26
    关注

    Check to make sure your database is also configured to store UTF8, some only do ASCII. Also, when displaying, make sure the HTML document is configured to display UTF8.

    Example:

    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-6">
    

    source: http://www.webdeveloper.com/forum/showthread.php?224111-Can-t-see-my-persian-arabic-text-in-HTML-editor

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事: