Can a uri-encoded character in a href be escaped?
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 2
- Joined: Tue Mar 07, 2023 4:51 pm
Can a uri-encoded character in a href be escaped?
Post by vicmortelmans »
Hi,
I have a mapref with a filename containing "%2A" (which is the URI-encoded form of "*").
When opening the map containing this mapref in Oxygen, an error is given:
Oxygen is decoding the filename before going to the filesystem, which I don't want in this case, because on the filesystem it is in the encoded form.
Note that I also have XSLT scripts using this file, run in Saxon, and they show similar behaviour, so it seems to be default behaviour for interpreting XML to decode URI-encoded characters.
There is a workaround that seems to work in Oxygen, to double encode the character: so "%2A" becomes "%252A".
I suppose that this is the way it should be done. Just posting this (1) for anyone who has the same issue and (2) for confirmation that there's indeed no better solution, that would allow me to have the "real" filename in the href attribute in the XML file.
Best regards,
Vic
I have a mapref with a filename containing "%2A" (which is the URI-encoded form of "*").
Code: Select all
<mapref format="ditamap"
href="../published/en-us/axk1438118744716.ditamap_20180406+1005+%2A/axk1438118744716_202301300844_008.ditamap"
class="+ map/topicref mapgroup-d/mapref "/>
Code: Select all
File not found: "D:\mcmsm\published\en-us\axk1438118744716.ditamap_20180406+1005+*\axk1438118744716_202301300844_008.ditamap".
Note that I also have XSLT scripts using this file, run in Saxon, and they show similar behaviour, so it seems to be default behaviour for interpreting XML to decode URI-encoded characters.
There is a workaround that seems to work in Oxygen, to double encode the character: so "%2A" becomes "%252A".
I suppose that this is the way it should be done. Just posting this (1) for anyone who has the same issue and (2) for confirmation that there's indeed no better solution, that would allow me to have the "real" filename in the href attribute in the XML file.
Best regards,
Vic
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Can a uri-encoded character in a href be escaped?
Post by chrispitude »
Hi Vic,
I think the workaround you described is actually the correct encoding. "%" must itself be written in escaped form, due to its use in escaped reserved characters. See:
URL encoding - Wikipedia
I think the workaround you described is actually the correct encoding. "%" must itself be written in escaped form, due to its use in escaped reserved characters. See:
URL encoding - Wikipedia
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Can a uri-encoded character in a href be escaped?
Hi Vic,
I confirm that if you have a file on disk named something like this "cop%2Ayright.dita" and you add a reference to it in the Oxygen DITA Maps Manager view using Oxygen's "Append Child->Reference" action (and not manually add a reference to it as you might have done), then the reference in the DITA Map looks like this:
So DITA references are URL-like and Oxygen escapes the original "%" to it's URL equivalent "%25".
If the original map you are editing in Oxygen comes as an export from a CMS, then the export has a bug in it if it does not escape the "%" to "%25" in the topicref name.
Regards,
Radu
I confirm that if you have a file on disk named something like this "cop%2Ayright.dita" and you add a reference to it in the Oxygen DITA Maps Manager view using Oxygen's "Append Child->Reference" action (and not manually add a reference to it as you might have done), then the reference in the DITA Map looks like this:
Code: Select all
<topicref href="cop%252Ayright.dita"/>
If the original map you are editing in Oxygen comes as an export from a CMS, then the export has a bug in it if it does not escape the "%" to "%25" in the topicref name.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service