Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2005-11-21 06:08:22

benforbes
New member
From: Melbourne, Australia
Registered: 2005-10-16
Posts: 9

Allowing escaped quotes within HTML tag attributes

Xinha seems to not like having escaped quotes within attributes, like so:

<img src='foo' tag='foo\'bar' />

If I type that in Text Mode, then go to WYSIWYG and back to text mode again, it becomes this:

<img src='foo' tag='foo\' />

Which part of the Xinha source code is responsible for this? I've been debugging furiously and I just cannot find where the change occurs.

Also, why are my apostrophes always changed to quotes? I can't find the code for that either.

Offline

#2 2005-11-21 08:39:16

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Allowing escaped quotes within HTML tag attributes

Your example is completely incorrec html, of course the browser screws it up for you, it doesn't know what to do with it.

Firstly, you should be using double quotes.  Secondly you do not escape by using backslashes anywhere in HTML or XML for that matter.

Use &#39; as the proper HTML entity "escape sequence" for ' if you must use single quotes to quote attributes.


James Sleeman

Offline

#3 2005-11-21 19:23:07

benforbes
New member
From: Melbourne, Australia
Registered: 2005-10-16
Posts: 9

Re: Allowing escaped quotes within HTML tag attributes

Thanks, that clears it up. I guess I'm too used to other programming languages.

One thing. In an HTML tag attribute, how do I differentiate between a quote and the sequence &# 34; if I have to write quotes as &# 34;? That's why I like using slashes to escape characters, you always know what you're getting. To be more specific, suppose I have some text I want to store in an attribute:

This is a quote: ". This is some text: & #34; .

If I have to change the quote to & #34;, I won't be able to change back correctly.

EDIT:
Nevermind, I'll just require that the &# ; sequences are considered special, so if someone actually wants to have "ampersand hash thirty four" in the text, they'll have to use the &# sequence for the ampersand or something.

Last edited by benforbes (2005-11-21 19:31:10)

Offline

Board footer

Powered by FluxBB