The ckeditor has the habit to escape characters like quotes or umlauts. This breaks the smarty-syntax when generating PDFs or mails. Is there a good work-around or solution?


Adding config.entities = false; to the ckeditor-config packages/ckeditor/config.js prevent ckeditor from escaping special characters.

This avoids the issue with smarty-syntax. But I am not sure if this doesn't produce other problems by not escaping anything... If anybody has experiences with that please post them here.

EDIT: In CiviCRM 4.7 ckeditor will be configureable. So it probably won't be necessary to patch packages/ckeditor/config.js anymore.

  • 1
    Yes - you can do it in the Administer>>Customize Data and Screens>>Display Preferences>>Configure CKEditor button: solved the Smarty errors, but revealed something else, but I expect that is my error!
    – Mick Kahn
    Oct 17 '17 at 11:07
  • @MickKahn What did you change in the configuration to solve the smarty errors?
    – Yossi
    Jan 4 '18 at 7:02
  • Hmm... can't now remember exactly what my issue was or what I did. I may just have been giving details of how you configure ckeditor in CiviCRM 4.7 onwards. It looks as if I only found a partial solution anyway. The only additional config I have is entities (Boolean) (whether to use HTML entities in the editor output) set to "false". Sorry to be vague.
    – Mick Kahn
    Jan 5 '18 at 7:54
  • This is much more important in Civi 5.43+ because of the use of quotation marks with the crmDate filter. Nov 10 '21 at 18:43

A much simpler solution is to keep the portion of your smarty code that has quotes into HTML comments, so that the quotes won't be escaped:

<!-- {capture assign=genre}{contact.gender}{/capture}
{if $genre == "F"}{assign var='salutation' value='Chère'}
{assign var='salutation' value='Cher'}{/if} 
<p>Chers parents, {$salutation} {contact.first_name},</p>
  • I am sorry: this doesn't work for me. Aug 19 '21 at 10:24

For anyone looking for how to do this in Configure CKEditor, the setting you need is /civicrm/admin/ckeditor and set entities = false under advanced options.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.