以如下字符串為例:
<h1>AVG?Internet?Security?full?license?free?of?charge!</h1>
<p>GRISOFT,?the?supplier?of?AVG?security?software,?has?released?the?Public?Beta?2?version?of?the?upcoming?AVG?7.5?edition.?Individual?programs?are?now?available?for?testing?purposes?to?everyone.?Why?not?participate?in?our?AVG?beta?testing,?complete?the?questionnaire?about?testing?AVG?7.5?and?get?a?free?license??We?will?draw?100?participants?from?all?of?the?received?feedback?forms.?Winners?will?obtain?a?two-year?license?for?AVG?Internet?Security?7.5?completely?free?of?charge.</p>
使用RichTextEditor進行編輯時,產生的html有oFCKeditor_InfoEdit_model_content.Value = 'xxx'字樣,由于字符串中包含單引號、雙引號、換行符等字符,編輯器無法進行處理,瀏覽器控制臺報js錯誤。
在freemarker中提供了一個StringUtil工具,在使用RichTextEditor前,應使用StringUtil.javaStringEnc()進行預處理。