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 14:05:02 -0600 (MDT)
- Subject: Re: [xsl] Escaping a utf-8 string
- Reply-to: xsl-list at lists dot mulberrytech dot com
Wesley W. Terpstra wrote:
> Again, all would be simple if only I could extract a hexademincal encoding
> of the utf-8 string in some way. Getting the ascii numeric value would work,
> or in fact, a function like "hexify" or something that takes the string and
> just output AB87B3AF873E or something would be fine since I could then stick
> =s and %s in the stream appropriately.
>
> Does anyone know of a way to get past this barrier in xsl?
This isn't the solution to your problem, but it might give you some ideas:
http://skew.org/xml/stylesheets/url-encode/
It essentially uses string-length() and substring-before() to find the
index of a character in a string, then applies a little arithmetic on
that number to arrive at character indices in another string to produce
the output.
If your goal is to produce UTF-8 sequences, it will be a little trickier,
and you are going to have to decide what reasonable subset of Unicode is
worth supporting in this manner, but it should be possible in pure XSLT.
- 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