Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   Reverse escaping in HTML (http://www.velocityreviews.com/forums/t156713-reverse-escaping-in-html.html)

Csaba2000 01-17-2004 05:45 PM

Reverse escaping in HTML
 
Most of the time when I think of escaping characters in HTML,
it's ensuring that I can print certain characters instead of havingt them
be interpreted by the HTML parser. (eg. I can have a less than sign
rendered by using "<" (without the quotes)).

But I want to go in the other direction. I want to be able to encode
arbitrary characters so that when they arrive at the browser they're
interpreted correctly at the appropriate time.

So, for example, I'd like to be able to do something like (note the
inner single quote):
<img src="Dinner.jpg" alt='"He's eating like a horse", she said'>

I'm after a generic solution, if possible, as the above example is
a fairly simplistic illustration. In addition, I may want to encode
other characters such as the alt itself or the symbols such as
the "less than" or "equal" sign (so this might actually be two
questions).

Thanks for any tips,
Csaba Gabor



Brian 01-17-2004 06:32 PM

Re: Reverse escaping in HTML
 
Csaba2000 wrote:
> I'd like to be able to do something like (note the inner single
> quote): <img src="Dinner.jpg" alt='"He's eating like a horse", she
> said'>


<img src="Dinner.jpg" alt="&quot;He's eating like a horse,&quot; she
said">

You can do it other ways, too; I do it this way, because it keeps my
attributes consistently double-quoted.

> I'm after a generic solution, if possible, as the above example is
> a fairly simplistic illustration.


I don't know what you mean by that.

> In addition, I may want to encode other characters such as the alt
> itself


The alt itself? What is that?

> or the symbols such as the "less than"


<img src="image.jpg" alt="n &lt; t">

<img src="image.jpg" alt="n < t">

(I must be misunderstanding you.)

> or "equal" sign (so this might actually be two questions).


<img src="image.jpg" alt="e = m*c squared">

--
Brian
follow the directions in my address to email me



All times are GMT. The time now is 12:53 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.