Skip to main content
Best Answer

URL's with *blank spaces* to FeatureReader

  • December 20, 2021
  • 4 replies
  • 649 views

hlynur
Supporter
Forum|alt.badge.img+10

Hello.

 

I am trying to run a bunch of online and zipped INSPIRE GML's through a Feature Reader with the dataset parameter set to a URL defined in an attribute.

 

All is good and stuff is happening for most of the data except the URL's that have a space in them, for example: 'http://www.catastro.minhap.es/INSPIRE/CadastralParcels/02/02024-CASAS IBAÑEZ/A.ES.SDGC.CP.02024.zip'

 

And those get sent to the reject port with the error message:

XML Parser error: ''Error in input dataset: 'URL' line: 1 column: 50 message: whitespace expected''

 

I did check out this one here:

How do I remove a non breaking space from an attribute? (safe.com)

But no luck , so any ideas?

Best answer by david_r

Generally speaking, spaces are not allowed in URLs. If the URL works in e.g. a browser, it's because the browser automatically does some work behind the scenes to make it work for you.

Try replacing the spaces with "%20", which represents a URL-encoded space. While you're at it, you may also have to encode the Ñ:

http://www.catastro.minhap.es/INSPIRE/CadastralParcels/02/02024-CASAS%20IBA%C3%91EZ/A.ES.SDGC.CP.02024.zip

 

You can also use the TextEncoder set to URL encoding, just make sure you don't encode the meaningful characters, such as the forward slash.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

david_r
Celebrity
  • Best Answer
  • December 20, 2021

Generally speaking, spaces are not allowed in URLs. If the URL works in e.g. a browser, it's because the browser automatically does some work behind the scenes to make it work for you.

Try replacing the spaces with "%20", which represents a URL-encoded space. While you're at it, you may also have to encode the Ñ:

http://www.catastro.minhap.es/INSPIRE/CadastralParcels/02/02024-CASAS%20IBA%C3%91EZ/A.ES.SDGC.CP.02024.zip

 

You can also use the TextEncoder set to URL encoding, just make sure you don't encode the meaningful characters, such as the forward slash.


hlynur
Supporter
Forum|alt.badge.img+10
  • Author
  • Supporter
  • December 20, 2021

Generally speaking, spaces are not allowed in URLs. If the URL works in e.g. a browser, it's because the browser automatically does some work behind the scenes to make it work for you.

Try replacing the spaces with "%20", which represents a URL-encoded space. While you're at it, you may also have to encode the Ñ:

http://www.catastro.minhap.es/INSPIRE/CadastralParcels/02/02024-CASAS%20IBA%C3%91EZ/A.ES.SDGC.CP.02024.zip

 

You can also use the TextEncoder set to URL encoding, just make sure you don't encode the meaningful characters, such as the forward slash.

hey and thanks for this, turned out that the space wasn't a problem after all, it was the "weirdo N letter".  And using TextEncoder and setting the attribute to URL failed cause, like you pointed out, replaced all slashes etc..


sigtill
Supporter
Forum|alt.badge.img+25
  • Supporter
  • December 20, 2021

To be "safe" I usually end up doing something like this to urlencode the filename and the previous folder. Using the FilenamePartExtractor + TextEncoder + StringReplacer prepares the url quite good for the FeatureReader.

 

image


hlynur
Supporter
Forum|alt.badge.img+10
  • Author
  • Supporter
  • December 20, 2021

To be "safe" I usually end up doing something like this to urlencode the filename and the previous folder. Using the FilenamePartExtractor + TextEncoder + StringReplacer prepares the url quite good for the FeatureReader.

 

image

Nice, thank you as well Sigbjørn & Antonio!