0
我在某个地方的字符集配置有问题 - 并且需要一些帮助。jquery post将错误的字符集添加到数据库中
我正在使用jQuery jeditable通过php更新数据库的值。当我通过此脚本发布øæå
时,数据库将被替换为æøå
。我也尝试过utf8_encode,但没有运气。定期交与øæå
工作正常
$(document).ready(function() {
$('.update_pipu_comment').editable('http://lin01.test.no/save.php?update=pipu_comment', {
event : 'dblclick',
submit : 'ok',
indicator : '<img src="image/indicator.gif">',
tooltip : 'doubleclick to edit'
});
});
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
//save.php
require('config.php');
$postvalue = $_POST[value];
$id = $_POST[id];
$update = $_GET[update];
if($update == 'pipu_comment') {
$res = mysql_query("UPDATE pinpuk SET comment = '$postvalue' WHERE id = '$id'");
}
echo $postvalue;
你的数据库是否设置了字符集UTF8? – gks
这只是像5小时前刚刚问过http://stackoverflow.com/questions/12737875/mysql-outputs-western-encoding-in-utf-8-php-file/ – Mamsaac
像一个训练有素的眼睛 - 可能是,但我阅读了关于您发布Mamsaac链接的问题的答案,并且根据该问题的答案找不到解决方案 – normarth