0

I have content in a Wygwam field. When I toggle to Source mode, I see numerous ’, ”, etc encoded characters. This is as desired.

When that content is output in my templates, using the Wygwam tag, and I view source in my browser, I see the rendered characters -- and -- not the encoded equivalents that were in the Source view in the Wygwam field.

I have verified that the entities and entities_processNumerical settings are both set to Yes in the editor configuration.

I discovered this while working on a plugin. The same conversion is happening via the $this->EE->TMPL->tagdata value. I'm loading this string into a DOMDocument to do some processing on it, and the rendered characters are breaking.

What should the output data look like?

EE: v2.5.5 - Build Date: 20121220

Wygwam: 2.6.3

6
  • 1
    How is the data in the database stored, is it html-encoded or not? And are you looking at view-source or via inspect-element from browser tools (e.g. firebug etc.) – GDmac Jan 24 '13 at 14:43
  • It looks like (via Sequel Pro, viewing table content) it's the characters in the database table, not the encoded entities. So why is Source mode showing the encoded entities in Wygwam if it's not converting them? – Mark J. Reeves Jan 24 '13 at 15:27
  • If I save the entry again, Wygwam converts them. So they're not being converted when pasted in. They're being rendered as the encoded entities when Wygwam has data to render, but the entry needs to be saved again for those to take effect. – Mark J. Reeves Jan 24 '13 at 15:29
  • @Pixel & Tonic - Is it possible to have this convert when 1st saved? – Mark J. Reeves Jan 24 '13 at 15:29
  • I'm not able to duplicate this locally. What do you mean "they're not being converted when pasted in"? – Brad Bell Jan 24 '13 at 20:26
1

When you paste directly into "Source" mode and hit submit, CKEditor doesn't get a chance to encode any HTML entities so they get passed to Wygwam unencoded. If you paste in source mode, switch to WYSIWYG mode, then submitted it would encode them. Alternatively, you could probably just use the "Paste as Plain Text" button from WYSIWYG mode and it would work, too.

It's working for you the 2nd time around because Wygwam defaults to WYSIWYG mode.

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.