ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Apostrophe / Single Quote breaking content

June 15, 2010 3:15pm

Subscribe [2]
  • #1 / Jun 15, 2010 3:15pm

    mark186282

    290 posts

    I’ve got an entry with a single quote in it.  It goes into the system just fine from the control panel (the entire entry stores in the DB).

    When I try and display the content on the page, content is truncated at the apostrophe.

    Example:

    (stored in DB)
    My content isn’t displaying correctly

    (output to browser)
    My content isn

    ....

    any suggestions are appreciated.

    thank you

  • #2 / Jun 15, 2010 3:35pm

    Ingmar

    29245 posts

    What version and build of EE are you using? Can you show us the tag pulling this data?

  • #3 / Jun 15, 2010 3:52pm

    mark186282

    290 posts

    What version and build of EE are you using? Can you show us the tag pulling this data?

    I’m using: 1.6.9, Build:  20100430

    index template:

    {exp:weblog:entries weblog="site_content" limit="1" rdf="off" disable="trackbacks|comments|categories|member_data"}
    
    {embed='site_common/snippet_header' title='{title}'}
    
    {embed='site_common/snippet_body' body='{body}'}
    
    {embed='site_common/snippet_footer'}
    
    {/exp:weblog:entries}

    site_common/snippet_body template:

    <div class="grid_12" id="bodycontent">
        {embed:body}
      </div>

    The content in question is stored in the “body” field in the site_content weblog.

    If I remove the apostrophy, the full amount of content displays fine

  • #4 / Jun 15, 2010 4:01pm

    mark186282

    290 posts

    I see the root of the issue in that the {body} tag is being processed prior to being tossed off into the embedded template, which is closing the embed variable tag.

    Can I escape that content such that it gets passed and quotes preserved?

  • #5 / Jun 15, 2010 4:39pm

    Ingmar

    29245 posts

    I see the root of the issue in that the {body} tag is being processed prior to being tossed off into the embedded template, which is closing the embed variable tag.

    That’s exactly what’s happening here, yes.

    Can I escape that content such that it gets passed and quotes preserved?

    You’d have to use some PHP for that, I think. The easiest solution for this particular problem would probably be to use double quotes around {body}.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases