作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 Access 文件中有泰语、日本、韩国字符(3 个字段)。
我在 PHP 中创建了一个脚本来连接到这个文件
但显示的字符显示 ??????? ???????还有????
设置什么以显示正常字符
这是我的脚本
<html>
<head>
<title>TEST</title>
</head>
<body>
<?
$objConnect = odbc_connect("test","","") or die("Error Connect to Database");
$strSQL = "SELECT * FROM table1";
$objExec = odbc_exec($objConnect, $strSQL) or die ("Error Execute [".$strSQL."]");
?>
<table width="600" border="1">
<tr>
<th width="20"> <div align="center">ID </div></th>
<th width="30"> <div align="center">Thai </div></th>
<th width="30"> <div align="center">Korea </div></th>
<th width="30"> <div align="center">Japan </div></th>
</tr>
<?
while($objResult = odbc_fetch_array($objExec))
{
?>
<tr>
<td><?=$objResult["ID"];?></div></td>
<td><?=$objResult["Thai"];?></td>
<td><?=$objResult["Korea"];?></td>
<td><?=$objResult["Japan"];?></div></td>
</tr>
<?
}
?>
</table>
<?
odbc_close($objConnect);
?>
</body>
</html>
最佳答案
<?
header('Content-Type: text/html;charset=utf-8');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TEST</title>
</head>
<title>TEST</title>
<body>
<?
$objConnect = odbc_connect("test","","") or die("Error Connect to Database");
odbc_exec($objConnect, "SET NAMES 'UTF8'");
odbc_exec($objConnect, "SET client_encoding='UTF-8'");
...
<td><?=mb_convert_encoding($objResult["Japan"], "SJIS");?></td>
关于php - 连接到 ACCESS 2007 (ODBC) 时如何在 PHP 上设置 UTF8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12996926/
我是一名优秀的程序员,十分优秀!