CKEditor无法显示我国的特殊字符ÆØÅ

时间:2017-08-19 20:59:52

标签: javascript html mysql ckeditor

我在撰写文章时使用CKEditor获得更好的体验。问题是,它使用某种代码而不是真正的字母,即æ,ø和å。

当从CKEditor向我的数据库发送数据时,这就是我在mysql数据库中的翻译方式:

æ= æ

ø= ø

å= å

我该怎么改变?元设置为utf_8。

以下是代码的相关部分:

<script>
            CKEDITOR.replace( 'article', {
    language: 'da'
});
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://cdn.ckeditor.com/4.7.2/standard/ckeditor.js"></script>
</head>

<body>
<textarea name="article" style="height:600px; width:90%;"></textarea>
</body>

我希望有人可以帮助我!

修改 将数据添加到数据库:

<?php
$servername = "";
$username = "";
$password = "";
$dbname = "";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 


$name = addslashes($_POST[writersName]);
$uid = addslashes($_POST[writersUid]);
$article = addslashes($_POST[article]);
$category = addslashes($_POST[category]);



$sql = "INSERT INTO artikler (name, uid, article, category)
VALUES ('".$name."', '".$uid."', '".$article."', '".$category."')";

if ($conn->query($sql) === TRUE) {
    header("Location: addArticle.php?name=1");
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>

1 个答案:

答案 0 :(得分:0)

现在我们知道问题出在CKEditor本身,你可以尝试这个配置:

entities = false;

在CKEditor里面:

<script>
    CKEDITOR.replace( 'article', {
        language: 'da',
        entities: false
    });
</script>