2011-08-04 46 views
1

沒有人知道如何配置tinyMCE來利用& nbsp;而不是緊湊的空間?將數據存儲在die db中會導致字符編碼問題。我們目前正在使用tinyMCE發送電子郵件,當發送這些字符時,他們會創建一堆問號,因爲我們在電子郵件中使用的編碼無法處理緊湊空間。TinyMCE生成緊湊的空間(160位ASCII)(十六進制中的0xA0)而不是 

任何幫助將不勝感激。

使用參見下面內容片段在初始化代碼

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"}} 
    ] 
}); 

回答

0

TinyMCE的需要插入保護空間(U + 00A0),因爲沒有他們的瀏覽器將只顯示一個單一的空間(你可以玩的HTML的TinyMCE的代碼插件來查看此行爲)。這可能會導致你描述的問題。對此的一個解決方案可能是替換那些受保護的空間onSaveContent或在將內容發送到服務器之前。第二種方法是在服務器端進行替換。

相關問題