Is there a way to use apostrophe’s in a textarea field without the output getting cut off at the apostrophe on the front-end in EE5? For example: “John’s Story” is displaying as “John” currently.
If I change the text formatting to XHTML or switch the fieldtype to a Wygwam field, or RTE it outputs the whole content, including whatever is after the apostrophe, but it also automatically adds an empty p tag which breaks the design of the code that we have, that an outside company built since that specific p tag needs a specific class to look right. We need the content without any tags.
An encoded apostrophe from MS Word works, but not if you type one in manually. So, this apostrophe works: ’ but not this one: ‘
Ok, with Robin’s help, we figured it out!
It was the way that we were setting up our layout variables.
If you use: {layout:set name='myztest' value='{ztest}’}
it breaks at the first single quote because it thinks the value is closed.
If you use: {layout:set name="myztest" value="{ztest}”}
it breaks at the first double quote because it thinks the value is closed.
However, if you use the full way, instead of the static-variable shortcut, these issues are avoided:
{layout:set name="myztest"}{ztest}{/layout:set}
Robin said, “it’s the same as with conditionals or using a parsed variable in a parameter. If there’s a quote in it, you have to be aware that it could be seen as a closing quote.”
Hope this helps someone else out!
Wouldn’t the variable modifier :attr_safe
work?
e.g. {layout:set name='myztest' value='{ztest:attr_safe}'}
or {layout:set name='myztest' value='{ztest:attr_safe unicode_punctuation="yes"}'}
I had a similar issue where :attr_safe
in combination with the unicode_punctuation
parameter set to “yes” came to the rescue.
https://docs.expressionengine.com/latest/templates/variable-modifiers.html#attr_safe
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.