Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Proper encoding >Thread Next - Re: Proper encoding Re: Proper encodingTo: NULL Date: 8/1/2005 3:12:00 PM * Roshawn Dawson wrote in microsoft.public.xsl: >I'm creatin an affiliate site for Amazon.com, and I am having an >encoding issue in xsl. Given a name that contains the é symbol >(latin small letter e with acute), how do I properly encode it? > >For instance, Amazon.com encodes the symbol as %E9 while in xsl it is >encoded as %C3%A9. How can I have it done Amazon's way, Please make sure %E9 is what you really need; this encoding is based on ISO-8859-1 which can't encode many characters (like the euro symbol or japanese "characters"), %C3%A9 would be the proper way here, this is based on UTF-8 which does not have the problems cited above. That said, all you need is encode the string to a byte array using the ISO-8859-1 encoding first, and then replace octets > 0x7F by their %xx equivalent. If you use the .NET Framework, the System.Web.Uri class has methods for this purpose. For XSLT you'd need to have this code in an extension function (or a complicated template), I don't think there is any other means available since the XSLT standard requires the results you get. -- Björn Höhrmann · mailto:bjoern@h... · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
