fatty- / daisy-pipeline

Automatically exported from code.google.com/p/daisy-pipeline
0 stars 0 forks source link

duplicate percent decoding functions in uri-functions #314

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Due to some conflicting branches, we happen to now have two different 
implementations and names for what seems to be the same URI-decoding function:

1. pf:percent-decode:
https://github.com/daisy-consortium/pipeline-modules-common/blob/9cea7abd5529b29
6c41f8b87277aaaa4446c7457/file-utils/src/main/resources/xml/xslt/uri-functions.x
sl#L182

2. pf:unescape-uri:
https://github.com/daisy-consortium/pipeline-modules-common/blob/9cea7abd5529b29
6c41f8b87277aaaa4446c7457/file-utils/src/main/resources/xml/xslt/uri-functions.x
sl#L267

We should disambiguate that and pick one implementation (possibly the best ;)

Original issue reported on code.google.com by rdeltour@gmail.com on 11 May 2013 at 12:45

GoogleCodeExporter commented 9 years ago
I added some XSpec tests (adapted from 
https://github.com/acg/python-percentcoding/blob/master/test.py).

It seeems that pf:percent-decode is having issues decoding unicode. 
pf:percent-decode is recursive so I'm guessing it might not be able to decode 
large chunks of encoded form data. pf:unescape-uri is more readable and compact 
so my vote is for pf:unescape-uri.

Do we want to handle encoded characters that are invalid in XML? For instance, 
if %00 is encountered in a string, should (1) an error be thrown, (2) %00 
remain unchanged, (3) %00 be replaced with an empty string?

Original comment by josteinaj@gmail.com on 13 May 2013 at 7:53

GoogleCodeExporter commented 9 years ago
OK to keep pf:unescape-uri. We need to remove pf:percent-decode.

About the invalid encoded characters, we should ideally do (2). 

Original comment by rdeltour@gmail.com on 11 Jun 2013 at 12:33

GoogleCodeExporter commented 9 years ago
fix ready for review in PR24: 
https://github.com/daisy-consortium/pipeline-modules-common/pull/24

Original comment by josteinaj@gmail.com on 28 Jun 2013 at 11:26

GoogleCodeExporter commented 9 years ago

Original comment by rdeltour@gmail.com on 2 Jul 2013 at 8:57