We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Apostrophe's in Textareas with No Formatting

How Do I?

jhorning's avatar
jhorning
5 posts
4 years ago
jhorning's avatar jhorning

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: ‘

       
jhorning's avatar
jhorning
5 posts
4 years ago
jhorning's avatar jhorning

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!

👍 1
       
Zignature's avatar
Zignature
5 posts
4 years ago
Zignature's avatar Zignature

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

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.