ShaneCunn / syntaxhighlighter

Automatically exported from code.google.com/p/syntaxhighlighter
GNU General Public License v3.0
0 stars 0 forks source link

cpp #include converts to uppercase in IE, adds closing tag in FF and Chrome #119

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. For C++ code enter this line:  #include <iostream>
2. View it in IE, FF and Chrome
3. IE changes it to #include <IOSTREAM>
4. FF and Chrome append </iostream> to end of source listing.

What is the expected output? What do you see instead?
#include <iostream>

What version of the product are you using? On what operating system?
1.5.1 on Windows, IE 7.0, FF 3, Chrome 

Please provide any additional information below.
Tested under Blogger

Original issue reported on code.google.com by Mitch.C....@gmail.com on 13 Nov 2008 at 8:44

GoogleCodeExporter commented 8 years ago
We are also seeing this. Same results regarding IE 7, firefox 3.1 beta, Chrome.

Original comment by graham.d...@gmail.com on 18 Nov 2008 at 4:44

GoogleCodeExporter commented 8 years ago
If I search and replace '<' with '<' then it goes away.

Original comment by Mitch.C....@gmail.com on 18 Nov 2008 at 4:59

GoogleCodeExporter commented 8 years ago
Search and replace in your code?

Original comment by graham.d...@gmail.com on 18 Nov 2008 at 6:27

GoogleCodeExporter commented 8 years ago
Copy the code to say Notepad, search and replace, then copy the results to your 
HTML 
page.

Original comment by Mitch.C....@gmail.com on 18 Nov 2008 at 6:37

GoogleCodeExporter commented 8 years ago
Yeah, I see that seems to work. Bit of a PITA. Would be nicer to add something 
like:

String.prototype.escapeHTML = function () {                                     

        return(                                                                 
            this.replace(/&/g,'&').                                         
                replace(/>/g,'>').                                           
                replace(/</g,'<').                                           
                replace(/"/g,'"')                                         
        );                                                                     
    };

then pass str.escapeHTML() to the brush...

Original comment by graham.d...@gmail.com on 18 Nov 2008 at 6:58

GoogleCodeExporter commented 8 years ago
You should be converting your '<' and '>' to the html equivalent > and < (and
other html entities) otherwise you're not creating valid html on your page.
As syntax highlighter is client side javascript, you run the risk of your 
browser
interpreting the < > as tags before the javascript is called.

Original comment by mdjwo...@gmail.com on 6 Dec 2008 at 10:29

GoogleCodeExporter commented 8 years ago
Try specifying attribute el as verbatim:

%CODE{lang="cpp" el="verbatim"}%
#include <iostream>
void foo() {
}
%ENDCODE%

Original comment by tay...@hotmail.com on 13 Feb 2009 at 12:06