简体   繁体   中英

Why Tinymce get content retrieves wrong code?

When I add emoji as follows <span lang=EN-US style='font-family:"Segoe UI Emoji",sans-serif;mso-fareast-language:EN-US'>&#128521;</span> into Tinymce 5 editor, it displays as usual, but when I save the content to the database, editor.getContent retrieves wrong code as below.

<p><span lang="EN-US" style="font-family: 'Segoe UI Emoji',sans-serif; mso-fareast-language: EN-US;">ߘ</span></p>

When I look at database I see it has been saved as ?? and when I open it with Tinymce again it display as ?? . It seams Tinymce getContent could not retrieves &#128521; in the correct way.

I use Javafx webView as wrapper to display Tinymce .

Anyone has any idea why, and how can we fix it?

Just add the entity_encoding: "numeric" , inside Tinymce configuration.

Characters will be converted into numeric entities. For example, a non-breaking space would be encoded as &#160; .

tinymce.init({
   selector: 'editor',
   width:'100%',
   height: '100%',
   entity_encoding: "numeric",
   plugins: 'print preview paste,... 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM