Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Site Bugs / Suggestions
  4. Trouble displaying code in a message

Trouble displaying code in a message

Scheduled Pinned Locked Moved Site Bugs / Suggestions
javascriptcsswcfcomxml
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Oakman
    wrote on last edited by
    #1

    When attempting to post suggested code changes to an article that involved emitting javascript code I found that the only way I could get the code I wrote included in my reply was to turn on do not interpret and not surround the code with a code block. It appeared from what was not shown that some of my code[^] was being seen as an attempt to inject malevolent code - or am I just doing something wrong?

    Jon

    Rob Graham wrote:

    100% subsidies are very popular among the 50% of the population that pays no income tax...

    Soap Box 1.0: the first, the original, reborn troll-less

    C 1 Reply Last reply
    0
    • O Oakman

      When attempting to post suggested code changes to an article that involved emitting javascript code I found that the only way I could get the code I wrote included in my reply was to turn on do not interpret and not surround the code with a code block. It appeared from what was not shown that some of my code[^] was being seen as an attempt to inject malevolent code - or am I just doing something wrong?

      Jon

      Rob Graham wrote:

      100% subsidies are very popular among the 50% of the population that pays no income tax...

      Soap Box 1.0: the first, the original, reborn troll-less

      C Offline
      C Offline
      Chris Maunder
      wrote on last edited by
      #2

      If you try and insert "<script" directly then the system sees you trying to insert a literal HTML SCRIPT block into the forum which is a no-no. You need to HTML-encode the <script part so that, in the editor, you end up entering "<script". When you paste code into the editor, and you have "Encode HTML tags when pasting" checked then this encoding is done automatically. If you don't have this checked, or you type the code directly, then you either need to HTML encode (to ensure you're not entering literal HTML) or check the "Do not interpret HTML tags" so the system will HTML encode automatically.

      cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP

      O 1 Reply Last reply
      0
      • C Chris Maunder

        If you try and insert "<script" directly then the system sees you trying to insert a literal HTML SCRIPT block into the forum which is a no-no. You need to HTML-encode the <script part so that, in the editor, you end up entering "<script". When you paste code into the editor, and you have "Encode HTML tags when pasting" checked then this encoding is done automatically. If you don't have this checked, or you type the code directly, then you either need to HTML encode (to ensure you're not entering literal HTML) or check the "Do not interpret HTML tags" so the system will HTML encode automatically.

        cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP

        O Offline
        O Offline
        Oakman
        wrote on last edited by
        #3

        "I see," said the blind man. Thanks.

        Jon

        Rob Graham wrote:

        100% subsidies are very popular among the 50% of the population that pays no income tax...

        Soap Box 1.0: the first, the original, reborn troll-less

        C 1 Reply Last reply
        0
        • O Oakman

          "I see," said the blind man. Thanks.

          Jon

          Rob Graham wrote:

          100% subsidies are very popular among the 50% of the population that pays no income tax...

          Soap Box 1.0: the first, the original, reborn troll-less

          C Offline
          C Offline
          Chris Maunder
          wrote on last edited by
          #4

          I edited your question for you so it now sparkles. (but seriously: what would make this more intuitive for you? Can you walk me through your perfect scenario?)

          cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP

          O 1 Reply Last reply
          0
          • C Chris Maunder

            I edited your question for you so it now sparkles. (but seriously: what would make this more intuitive for you? Can you walk me through your perfect scenario?)

            cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP

            O Offline
            O Offline
            Oakman
            wrote on last edited by
            #5

            I edited your question for you so it now sparkles.

            Are you trying to increase your rep?

            what would make this more intuitive for you?

            Excellent Question. I think what would be ideal for me would be to have the <pre> tags signal that anything in between should be encoded. Otherwise you can end up with something like the above, all to get the tag to show up.

            Jon

            Rob Graham wrote:

            100% subsidies are very popular among the 50% of the population that pays no income tax...

            Soap Box 1.0: the first, the original, reborn troll-less

            C 1 Reply Last reply
            0
            • O Oakman

              I edited your question for you so it now sparkles.

              Are you trying to increase your rep?

              what would make this more intuitive for you?

              Excellent Question. I think what would be ideal for me would be to have the <pre> tags signal that anything in between should be encoded. Otherwise you can end up with something like the above, all to get the tag to show up.

              Jon

              Rob Graham wrote:

              100% subsidies are very popular among the 50% of the population that pays no income tax...

              Soap Box 1.0: the first, the original, reborn troll-less

              C Offline
              C Offline
              Chris Maunder
              wrote on last edited by
              #6

              No rep from fixing forum postings ;) If we auto-encode stuff within pre tags then it means you can't use HTML within those tags so you can't highlight or make bold parts of the code. Trying to please everyone ends up pleasing << everyone

              cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP

              O 1 Reply Last reply
              0
              • C Chris Maunder

                No rep from fixing forum postings ;) If we auto-encode stuff within pre tags then it means you can't use HTML within those tags so you can't highlight or make bold parts of the code. Trying to please everyone ends up pleasing << everyone

                cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP

                O Offline
                O Offline
                Oakman
                wrote on last edited by
                #7

                Chris Maunder wrote:

                Trying to please everyone ends up pleasing << everyone

                Truer words were ne'er spoke.

                Jon

                Rob Graham wrote:

                100% subsidies are very popular among the 50% of the population that pays no income tax...

                Soap Box 1.0: the first, the original, reborn troll-less

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups