Search code examples
javafxtinymceemojitinymce-pluginsjavafx-webview

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?


Solution

  • 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,...