ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: <denis.maier@unibe.ch>
To: <ntg-context@ntg.nl>
Subject: [NTG-context] XML, multiple spaces encoded as %20 get merged into one space
Date: Wed, 6 Sep 2023 10:28:02 +0000	[thread overview]
Message-ID: <ZRAP278MB0495C9C8C7D59B4EB8E08DD283EFA@ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2428 bytes --]

Hi,

I have the example below that uses the three images in the attachment.
For some reason multiple spaces encoded as %20 get merged into a single %20.

The first image (<test  two20spaces.pdf>) does not get included even though the name is correct.
The second image (<test one space.pdf>) gets included. Filename is correct.
The third image (<test not two space.pdf>) gets included even though the actual file name does not contain two spaces (but @xlink:href does).

Any ideas what is going on here?

Then, in the case of the link, the two %20 end up as a single %20.

Best,
Denis

\setupinteraction[state=start]

\startxmlsetups xml:test
                \xmlsetsetup{#1}{*}{-}
                \xmlsetsetup{#1}{document|fig}{xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{test}{xml:test}

\startxmlsetups xml:document
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:fig
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:graphic
  \externalfigure[\xmlfilter{#1}{./url('xlink:href')}]
\stopxmlsetups

\startxmlsetups xml:link
  https://uv-v4.netlify.app/\#?manifest=\xmlfilter{#1}{./url('xlink:href')}
\stopxmlsetups

\startxmlsetups xml:fig
                \startplacefigure[title=Test]
                \startalignment[center]
                               \goto
                               {\xmlfilter{#1}{/graphic/command(xml:graphic)}}
                               [url(\xmlfilter{#1}{/link/command(xml:link)})]
                \stopalignment
                \stopplacefigure

                \goto{test}[url(\xmlfilter{#1}{/link/command(xml:link)})]
\stopxmlsetups


\startbuffer[test]
<?xml version="1.0" encoding="UTF-8"?>
<document>

<fig>
<graphic xlink:href="test%20%20two%20spaces.pdf"/>
<link xlink:href="https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20IV%2076%20%20Spiegel%20vorn_Teigstempel"/>
</fig>

<fig>
<graphic xlink:href="test%20one%20space.pdf"/>
<link xlink:href="https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20IV%2076%20%20Spiegel%20vorn_Teigstempel"/>
</fig>

<fig>
<graphic xlink:href="test%20%20not%20two%20spaces.pdf"/>
<link xlink:href="https://iiif.ub.unibe.ch/presentation/v2.1/berner-inkunabeln/manifest/Inc%20IV%2076%20%20Spiegel%20vorn_Teigstempel"/>
</fig>
</document>
\stopbuffer


\starttext

\xmlprocessbuffer{test}{test}{}

\stoptext


[-- Attachment #1.2: Type: text/html, Size: 8445 bytes --]

[-- Attachment #2: test  two spaces.pdf --]
[-- Type: application/pdf, Size: 4301 bytes --]

[-- Attachment #3: test one space.pdf --]
[-- Type: application/pdf, Size: 4301 bytes --]

[-- Attachment #4: test not two spaces.pdf --]
[-- Type: application/pdf, Size: 4301 bytes --]

[-- Attachment #5: Type: text/plain, Size: 495 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2023-09-06 10:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06 10:28 denis.maier [this message]
2023-09-06 14:59 ` [NTG-context] " Pablo Rodriguez
2023-09-06 16:14   ` Hans Hagen via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZRAP278MB0495C9C8C7D59B4EB8E08DD283EFA@ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM \
    --to=denis.maier@unibe.ch \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).