TinyMCE UTF

系统教程 行业动态 更新时间:2024-06-14 16:55:57
TinyMCE UTF-8保存到MySQL数据库(TinyMCE UTF-8 saving to MySQL Database)

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

输入有UTF-8(土耳其文字符)。 所以当我在TinyMCE输入中键入Türkçe并发送它时,PHP后端接收到这个字符串:

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

PS:

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

我想,我需要用PHP转换它们。

或者让TinyMCE正确发送它们的方法?

谢谢你的帮助 !

PS 2:

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

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

PS 3

我猜这些字符像&uuml; 是土耳其字符的HTML等效字体,所以htmlspecialchars_decode()应该可以工作,但不接受土耳其字符。 也许一种方式来htmlspecialchars_decode解码UTF-8字符?

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

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>

P.S.:

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

I need to convert them in PHP, I guess.

Or a way for TinyMCE to send them correctly?

Thanks for any help !

P.S. 2:

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).

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

P.S. 3

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>

Use this code

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

更多推荐

本文发布于:2023-04-10 11:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/36cd3d46261cd25ccb8a62bff5e339ad.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:TinyMCE   UTF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!