Re: [xsl] decoding percent-escaped octet sequences

Subject: Re: [xsl] decoding percent-escaped octet sequences
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 20 May 2011 11:52:19 -0400
Generally, when you're doing string manipulations inside XSLT/XPath,
there really is no such thing as ISO-8859-1, UTF-8 or any other
encoding, since the "string" data type in XPath is just a string of
Unicode characters.  The encoding of the input is used to map the
sequence of octets to Unicode characters on the way in and the
requested encoding of the output is used to do the reverse on the way
out.

Percent-escaping is sort of an exception since it is, really, a form
of encoding, but not one that is generally handled automatically by
the parser, serializer, etc.  So, you may need to decode the
percent-escapes, but you shouldn't have to worry about the overall
encoding.

If you think your use case requires that you really do need to deal
with encodings, please tell us a little more about it, so that we
might be able to better suggest a solution.  How is this string
getting into your transform while still being encoded?

-Brandon :)


On Fri, May 20, 2011 at 11:34 AM, Julian Reschke <julian.reschke@xxxxxx>
wrote:
> Hi,
>
> do XSLT/XPath2 offer an elegant way to convert percent-escaped octet
> sequences to strings (both for ISO-8859-1 and UTF-8).
>
> So far I found codepoints-to-string, but that would mean that I'd still
have
> to to
>
> 1) percent-escaped-string to sequence of octets, and
> 2) sequence-of UTF-8 octets to seequence of codepoints.
>
> Did I miss something here?
>
> Best regards, Julian

Current Thread