开发者

TinyMCE generating compact spaces (160 in ASCII) (0xA0 in HEX) instead of  

does anyone know how to configure tinyMCE to utilize   instead of the compact spaces? Storing the data in die db causes character encoding issues. We are currently utilizing tinyMCE to send emails and when these characters are sent they create a bunch of question marks, because the encoding we use in emailing cannot handle the compact spaces.

Any help would be greatly appreciated.

See below snippet for init code

tinyMCE.init({
    // General options
    mode : "textareas",
    theme : "advanced",
    skin : "o2k7",
    plugins : "spellchecker,style,layer,table,advhr,inlinepopups,insertdatetime,print,contextmenu,fullscreen,noneditable,visualchars,xhtmlxtras,wordcount,advlist,paste,tabfocus",

    // Theme options
    theme_advanced_buttons1 : "newdocument,spellchecker,|,print,|,styleselect,formatselect,fontselect,fontsizeselect,|,fullscreen",
    theme_advanced_buttons2 : "bold,italic,underline,strikethrough,sub,sup,|,backcolor,forecolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,|,insertdate,inserttime,|,code,|,showmorebuttons,",
    theme_advanced_buttons3 : "tablecontrols,|,insertlayer,moveforward,movebackward,absolute,|,styleprops,hr,removeformat,visualaid,|,charmap,advhr,",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    setup : function(ed) {
        // Add a custom button
        ed.addButton('showmorebuttons', {
            title : 'Expand Advanced Toolbar',
            image : '/img/email/toolbars.gif',
            onclick : function() {
                showMoreButtons(ed.id);
            }
        });
    },
    oninit : function(){
        var tmpIdent = tinyMCE.activeEditor.id;
        document.getElementById(tmpIdent + "_toolbar3").style.display = 'none';
        var currentHeight = document.getElementById(tmpIdent+"_ifr").style.height;
        currentHeight = currentHeight.substring(0, currentHeight.indexOf("px"));
        currentHeight = (currentHeight*1)+15;
        document.getElementById(tmpIdent+"_ifr").style.height=currentHeight+"px";
    },
    apply_source开发者_运维百科_formatting : false,
    force_p_newlines : false, 
    remove_linebreaks : false,
    forced_root_block : false,
    force_br_newlines : true,
    entity_encoding : "raw",
    // Example content CSS (should be your site CSS)
    content_css : "/tinymce/example/css/content.css",

    relative_urls : false,
    // Style formats
    style_formats : [
        {title : 'Word H1', block : 'h1', styles : {color : '#365f91', 'font-family' : 'cambria'}},
        {title : 'Word H2', block : 'h2', styles : {color : '#4f81bd', 'font-family' : 'cambria'}},
        {title : 'Word H3', block : 'h3', styles : {color : '#4f81bd', 'font-family' : 'cambria'}},
        {title : 'Word H4', block : 'h4', styles : {color : '#4f81bd', 'font-family' : 'cambria', "font-style" : "italic"}}
    ]
});


Tinymce needs to insert protected spaces (U+00A0) because without them browsers would display only one single space (you may play around with the html in tinymce using the code plugin to see this behavior). This may lead to the problems you described. One solution to this could be to replace those protected spaces onSaveContent or before sending the content to the server. The second approach is to do the replace on server-side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜