[wxPython] Backslashes in wxHtmlWindow

Alex Southgate wrote:

I am having a bit of trouble passing the backslash character ( "\" ) in an
attribute of a tag. Specifically I am creating a control using the wxp
object:

<wxp class="someclass" width="600" height="200">
        <param name="bgColor" value="#FFFFFF"/>
        <param name="someText" value="text \n \t moretext"/>
</wxp>

Here you can see that in the value of the someText parameter I am passing
the newline and tab escape codes.

The issues seems to be that when the string is passed into the object the
"\" become "\\" and the resulting text looks like:

text \\n \\t moretext

this is the representation of a _single_ \ when printed
you can easyly test it using raw strings

r'\n\t'

'\\n\\t'

len(r'\n\t')

4

Do I need to start playing with the html parser??

HTML knows nothing of C/python conventions for passing newline and tab,
so you should probably include them as-is,
i.e. as a real newline and tab.

···

------------
Hannu