Re: Right paren in urls

Bert Bos writes:
 > The safe way to use a literal parenthesis, in a URL or elsewhere, is
 > to escape it with a backslash. Section 7.2 ("parsing conventions")
 > explains that any character can be escaped with a backslash to remove
 > its special meaning. The way to write the URL is thus:
 > 
 >     BODY { background: url(right\)paren.gif) }
 > 

Thanks much. This is exactly the information I needed. 

At the risk of pointing out well known stuff.... The reason I had guessed
at the quoting mechanism was because it would allow "safe" URLs to be
written the same way in the HTML Style element as any other HTML
element. For example:  

   <BODY BACKGROUND="right)paren.gif"> 
   <STYLE> BODY { background: url("right)paren.gif") } </STYLE>

This is a nice property for authors, and perhaps for certain kinds of HTML
parsing tools (e.g. constructing the second line from the first). The style
attribute doesn't work as cleanly, because single-quote is a "safe"
character in URLS. For example, both

   <BODY STYLE='background: url("right)paren.gif")'>
   <BODY STYLE="background: url('right)paren.gif')">

are fine, but if the right paren is replaced with a single-quote it doesn't
work as smooth. (Double-quote isn't a problem because it's not a safe
character.) Still, this idea might be worth considering.

Again, thanks much for the prompt reply.

--Jon Degenhardt
  DocuMagix, Inc.

Received on Wednesday, 11 September 1996 07:42:23 UTC