Trouble displaying code in a message
-
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...
-
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...
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
-
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
"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...
-
"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...
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
-
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
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...
-
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...
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
-
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
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...