[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: unpacking percent-escaped URI components

Subject: Re: unpacking percent-escaped URI components
From: "Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 7 Nov 2022 23:12:30 -0000
Re:  unpacking percent-escaped URI components
Im surprised that there is not the inverse of encode-for-uri() but I do not
find anything the XPath 3.1 functions and operators.

Cheers,

E.
_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> |
Twitter<https://twitter.com/servicenow> |
YouTube<https://www.youtube.com/user/servicenowinc> |
Facebook<https://www.facebook.com/servicenow>

From: Graydon graydon@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Monday, November 7, 2022 at 4:00 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  unpacking percent-escaped URI components
[External Email]

On Mon, Nov 07, 2022 at 09:36:47PM -0000, Martin Honnen martin.honnen@xxxxxx
scripsit:
> On 11/7/2022 10:29 PM, Martin Honnen martin.honnen@xxxxxx wrote:
> > On 11/7/2022 9:55 PM, Graydon graydon@xxxxxxxxx wrote:
> > > Unpacking RFC 4122 percent-escaped strings for code points less than
> > > 256 is straightforward --
> > >
> > > tokenize($value,'%')[normalize-space()] ! local:H2D(.) !
> > > codepoints-to-string(.)
> > >
> > > where local:H2D is a hex-digits-to-decimal-integer function.
> > >
> > > When the escaped value goes above 255, as with U+201C and U+201D, ,
> > > the escapes start being multi-octet UTF-8, so %E2%80%9C and %E2%80%9D.
> > >
> > > Is there a useful way to turn those multi-octet escapes back into
single
> > > characters in XPath or XSLT?
> > >
> > I wonder whether with Saxon PE or EE you can use e.g.
> >
> > (tokenize($value,'%')[normalize-space()] ! local:H2D(.)) =>
> > saxon:octets-to-hexBinary() => saxon:hexBinary-to-string('UTF8')
> >
> Yes, now tested e.g.
>
>   (226, 128,  156, 226, 128,  157) => saxon:octets-to-hexBinary() =>
> saxon:hexBinary-to-string('UTF8')
>
> gives 

I am impressed!

(And only feeling a little bit like a cabbage.)

Thank you!

--
Graydon Saunders | graydonish@xxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor ("That passed, so may this.")

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.