This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Escaping a utf-8 string
- From: Mike Brown <mike at skew dot org>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Sat, 17 Aug 2002 19:51:41 -0600 (MDT)
- Subject: Re: [xsl] Escaping a utf-8 string
- Reply-to: xsl-list at lists dot mulberrytech dot com
Wesley W. Terpstra wrote:
> Well, there is this uri-escape function in xpath 2.0:
> http://www.w3.org/TR/xquery-operators/#func-escape-uri
> sadly, though, it only came into existence two months ago (Jun 17).
>
> It would be enough since then "translate(escape-uri(str, true), '%', '=')"
> would give me a suitable string for RFC822 headers when wrapped with
> =?utf-8?Q?...?=
>
> However, this function doesn't explain very clearly what is done for
> non-ascii characters; are they represented by a utf-8 stream?
"The effect of the function is to replace any special character in the string
by an escape sequence of the form %xx%yy..., where xxyy... is the hexadecimal
representation of the octets used to represent the character in UTF-8."
Seems clear enough to me, and would be what you want. And you should be able
to use it reliably in client side processors by 2005 or so.
> Portability is an issue. :-( The pages are all xml with the intention that
> then browsers can use different xsl to format them to user taste.
Some would start laughing at this point. :)
- Mike
____________________________________________________________________________
mike j. brown | xml/xslt: http://skew.org/xml/
denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list