我发送TinyMCE输入到POST(一个php文件),然后将它保存在MySQL数据库中。
输入有UTF-8(土耳其文字符)。 所以当我在TinyMCE输入中键入Türkçe并发送它时,PHP后端接收到这个字符串:
<p>Türkçe</p>PS:
MySQL设置为utf8_unicode_ci排序规则,因此它可以正确保存UTF-8字符。
我想,我需要用PHP转换它们。
或者让TinyMCE正确发送它们的方法?
谢谢你的帮助 !
PS 2:
我认为这个问题是关于TinyMCE本身的,所以我想这个解决方案将转换TinyMCE输出(无论是在TinyMCE javascript还是接收PHP脚本)。
即:我不认为改变我的PHP配置是解决方案。
PS 3
我猜这些字符像ü 是土耳其字符的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ürkç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 ü 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>更多推荐
发布评论