Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

URL encode

hi,
i will be getting a value from database and put the value in the url of the FileFetch step and downloading the file.
will it be possible to encode url for the value fetched from the database.
please help.
thanks
jayanth
Labels (2)
2 Replies
_AnonymousUser
Specialist III

Don't know why you want to encode the URL for tFileFetch, but here's how it should work:
Put java.net.URLEncoder.encode(yourString, "UTF-8") around the string you want to encode. Tested inside a tMap, works fine (for example "www.test.de/index.php?t=1&m=2" becomes "www.test.de%2Findex.php%3Ft%3D1%26m%3D2").

Regards,
Theo
Anonymous
Not applicable
Author

Hi,

thats a really old post, but i ran into the same problem and want to share my solution.

User often choose weird filenames, thats why i want to handle it this way.

It seems that the encode methode is not really designed to encode a URL in the way we need it here for WebDAV.

For example, a space in filename will be encoded to "+" instead of "%20". I searched a lot and at the end i give up and use a little workaround.

Important thing: Don't encode the entire URL, in my case i encode the filename only and it works.

globalMap.put("URI",java.net.URLEncoder.encode(((String)globalMap.get("Filename")),"UTF-8").replace("+", "%20"))

webdav.png 

webdav2.png

 

regards

 

Lars