TinyMCE UTF-8保存到MySQL数据库 [英] TinyMCE UTF-8 saving to MySQL Database

查看:385
本文介绍了TinyMCE UTF-8保存到MySQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将TinyMCE输入发送到POST(一个php文件),然后保存在MySQL数据库中。

I send TinyMCE input to POST (a php file), then save it in MySQL Database.

输入具有UTF-8(土耳其字符)。因此,当我在TinyMCE输入中键入Türkçe并将其发送到post时,PHP后端会收到以下字符串:

The input has UTF-8 (Turkish characters). So when I type Türkçe inside the TinyMCE input and send it to post, PHP backend receives this string :

<p>T&uuml;rk&ccedil;e</p>

如何将它转换回Türkçe所以我可以在MySQL中正确保存它。

How can I convert it back to Türkçe so I can save it correctly in MySQL ?

MySQL设置为 utf8_unicode_ci 排序规则,因此它可以正确保存UTF-8字符。

MySQL is set to utf8_unicode_ci collation, so it can save UTF-8 characters correctly.

我需要在PHP中转换它们。

I need to convert them in PHP, I guess.

或者TinyMCE正确地发送它们?

Or a way for TinyMCE to send them correctly?

感谢任何帮助!

我认为这个问题是关于TinyMCE本身的,所以我想解决方案将转换TinyMCE输出(在TinyMCE javascript或接收PHP脚本) 。

I think that this issue is about TinyMCE itself, so I guess the solution will be converting the TinyMCE output (either in TinyMCE javascript, or the receiving PHP script).

ie :我不认为改变我的PHP配置是解决方案。

i.e. : I don't think changing my PHP configuration is the solution.

我想这些字符像& uuml; 是土耳其字符的HTML等效项,因此 htmlspecialchars_decode()应该可以工作,但不接受土耳其语字符。

I guess these characters like &uuml; are the HTML equivalents of Turkish characters, so htmlspecialchars_decode() should work, but it does not accept Turkish characters. Maybe a way for htmlspecialchars_decode to decode UTF-8 Characters ?

推荐答案

使用此代码

    <script type="text/javascript">
       tinymce.init({
           entity_encoding : "raw"
        });
    </script>

这篇关于TinyMCE UTF-8保存到MySQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆