& not rendering in browser as &?

buzz05 - January 13, 2009 - 23:52
Project:GeSHi Filter for syntax highlighting
Version:6.x-1.1
Component:Filtering
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

I'm using the Geshi Filter to apply source formatting to some xml code.

Problem is when an & is encountered it isn't converted to an & symbol (see attached).

Running the latest version of Geshi & Drupal 6.5.

Is this a bug or is there somewhere in the admin were I need to set this up?

Thanks.

AttachmentSize
example-a.gif585 bytes

#1

soxofaan - January 14, 2009 - 06:34
Status:active» by design

this not a bug but a feature.
GeSHi filter just renders the given source code as is,
it does not interpret/process/encodes/decodes it or something

so if you give it &, it renders &
if you give it &, it renders &

#2

soxofaan - January 14, 2009 - 07:17

for clarity: GeSHi filter does encode everything in the markup

what I mean is: you submit a & through the input text field and a & will show up in the browser, the underlying markup however will contain a & of course.

the same if you input &, but the markup will then contain & which renders as &

#3

buzz05 - January 18, 2009 - 22:46

Ok that's good to know.

To follow up on the initial problem when I replace the & with an & it breaks the color formatting and all code appearing after the & looses its color formatting and renders in plain yellow.

#4

soxofaan - January 18, 2009 - 23:06
Status:by design» postponed (maintainer needs more info)

can you give an example of the code (both what you input, and re markup that is returned), the used language and a screenshot of the result?

#5

yyudhistira - February 14, 2009 - 19:05

I use tinymce module with wysiwyg api module. I used the preformatted paragraph, which renders it as 'pre' instead of 'p'. I suppose everything inside 'pre' is not converted to html format, i.e. & is changed into &

So now I have & converted twice into &

Do you have any idea how to fix this? Is this tinymce problem or maybe geshi filter can intellegently convert back any html format within 'pre' tag to it's original, i.e. convert & back into & before doing the rest?

#6

notanumber6789 - March 3, 2009 - 02:41

Hi, has anyone gotten the "&" character to display correctly using GeSHi?

I am using TinyMCE, and codefilter. I enter in text inside tags, for example "apt-get update && apt-get upgrade". The "&" are saved as "&" in the underlying HTML, but rendered inside TinyMCE and published correctly as "&" when codefilter is enabled. So far so good, but when GeSHi is also enabled it displays the characters as "&" again. Everything else seems to work well.

This also happens when I use double quotation marks, or when using FCKeditor instead of TinyMCE.

Is there any way to fix this? GeSHi looks great, but it is useless if I can't use ampersands or double quotation marks.

If this is a 'feature' and not about to change, can someone maybe suggest a different plugin? All I want is a nice text box for bits of code like I get in MediaWiki, seems simple but I have been trying to get this functionality in Drupal for days now ...

#7

soxofaan - March 3, 2009 - 18:12

GeSHi looks great, but it is useless if I can't use ampersands

GeSHi filter supports ampersands and other weird characters, but the problems lies with the Rich Text Editors (FCKeditor and TinyMCE) you are using. They change the ampersands client side to & amp;, before GeSHi filter kicks in. When GeSHi filter (server side) receives the & amp;, it does not know that this was intended as &, and it encodes & amp; as & amp; amp;, which renders as & amp; in your browser.

To solve this issue in a clean way, Drupal's rich text editor support has to be standardized, which is on the table for Drupal 7.

 
 

Drupal is a registered trademark of Dries Buytaert.