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.

Prevent curly quotes in code blocks

July 18, 2012 10:42pm

Subscribe [3]
  • #1 / Jul 18, 2012 10:42pm

    ralph.m

    225 posts

    I often use normal HTML code tags, but I’m finding that if I use straight quotes, they get converted to curly quotes, which is pretty ugly in code. This doesn’t happen inside pre tags, so I was wondering if there’s any way to prevent it within code tags. I realize you can use the EE [ code ] tags, but it pulls in a lot of formatting that I don’t want to have to override. (I use them inline, which the EE code tags create a block, and also changes font size and coloring—grrr.)

    I recommend that the system also include HTML code tags as an exemption to curly quotes, just as is the case with pre.

    Any suggestions for what to do here? Is there some way I can add code tags to the exception myself?

    Thanks. 😊

    EDIT: I guess another solution would be to strip out the EE styles for [ code ] ... but I’d rather not hack the system, as it’s a pain to remember when upgrading.

  • #2 / Jul 19, 2012 3:14pm

    Shane Eckert

    7174 posts

    Hey ralph.m,

    I hear you man. This has been brought up before. This typically happens when you copy and paste in the “curly” quotes from a formatted source like a word doc.

    Because ExpressionEngine is meant to be as flexible as possible, we make as few assumptions as possible about the content you enter. So we are going to present exactly what is entered.

    There may be a work around, but that would be outside of support. If you would like I can move this thread to the Community Help Forum.

    Out of curiosity, what version of ExpressionEngine are you using and is this in an RTE text area or a normal one?

    Is there anything else you need?

    Cheers,

  • #3 / Jul 19, 2012 6:45pm

    ralph.m

    225 posts

    Thanks Shane.

    This typically happens when you copy and paste in the “curly” quotes from a formatted source like a word doc.

    Yeah, I know that one, but in this case, it’s code straight from my code editor, definitely with straight quotes. Inside a pre element they get left alone, but otherwise the system automatically converts them, which I don’t want.

    is this in an RTE text area or a normal one?

    I’m using EE 2.5.2, using the ‘out of the box’ textarea input, set to XHTL formatting, with formatting buttons showing. Not using the new RTE at this stage, but might give it a go and see if that makes a difference.

    we make as few assumptions as possible about the content you enter. So we are going to present exactly what is entered.

    What I’m talking about is the auto conversion that is described here:
    http://ellislab.com/expressionengine/user-guide/general/text_formatting.html

    The system converts straight quotes to curly ones, except in pre elements, but I’d suggest extending that to HTML code tags, too, as no one is ever going to want curly quotes in a snippet of code. I’m writing blog posts for web developers, and it looks awful to have curly quotes in code snippets, but there seems to be no way to prevent the system converting them. I guess as a workaround I’ll have to find the character references for straight quotes and use those instead. That’s all I can think of right now ...


    EDIT: OK, just tried the RTE as an alternative, and it doesn’t convert the quotes to curly ones inside code tags ... so there’s another way around it. I still would prefer to use the plain textarea, though.

  • #4 / Jul 20, 2012 2:34pm

    Shane Eckert

    7174 posts

    Hello ralph.m,

    Gotcha. Thanks for the clarification.

    I would suggest a Feature Request for your suggestion about extending that to HTML code tags.

    Glad the RTE is working a bit better for you.

    Is there anything else I can help with?

    Cheers,

  • #5 / Jul 21, 2012 4:52am

    ralph.m

    225 posts

    Thanks Sane! I shall indeed make a feature request. All good for now. 😊

  • #6 / Jul 23, 2012 4:06pm

    Kyle Cotter

    730 posts

    Glad Shane could help, Ralph. If you have any more questions, feel free to open a new thread.

    Thanks.

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

ExpressionEngine News!

#eecms, #events, #releases