Escaping a utf-8 string
I am sure this is a commonly asked question, but I couldn't find it in the FAQ: I want to escape an xsl string. Unfortunately I need the ascii value of the characters in it. I understand however, that since things are unicode it is not this simple. Fortunately, I actually want the string as utf-8 and to pop off a character at a time from the utf-8 string. This way I can write a nice email subject line: A contrived example: =?utf-8?Q?bleh bleh =FD=AC blah blah?= Where presumably =FD=AC is some valid utf-8 encoding sequence Also, I would like to be able to encode uris. I know that xfunctions provide a uri-escape() function, but this is not on my target xsl platforms (IE6 xsl and libxslt1). Incidently, if this worked I could just translate(uri-escape(str, true), '%', '=') for the email example and use uri-escape for the uris I need to deal with. 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? Thanks; this is really important to me. -- Wesley W. Terpstra <wesley@xxxxxxxxxxx> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format