I tried decoding encoded URL’s with a recursive loop but it hit’s the sound barrier pretty early when processing bigger amounts of URL’s. Any option to include an URL decode node?
Yes - in fact it was supposed to be in the same release as the URL Encode node. Due to vacations it will be a couple of weeks before that is out there. In the interim, if you are happy venturing into a Java Snippet node, then the following should work:
try {
out_Decoded = URLDecoder.decode(c_URL, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
// Should never happen!
out_Decoded = null;
}
(With an input column ‘URL’ and a new output column ‘Decoded’)
Steve
Ha, tried the Java node but I am not familiar with Java at all I must admit. getting “cannot be resolved” for URLDecoder, StandardCharsets and UnsupportedEncodingException. What did I missed?
Sorry, my over-simplification there…
At the top of the snippet box, under neath the line // Your custom imports
you need to add the following lines:
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.io.UnsupportedEncodingException;
(You can get this automatically by hitting CTRL+Space once you are part-way through typing the java class name, e.g. URLDec
, StandardChar
and so on in the snippet - beware though, sometimes there is a choice!)
You should end up with something like:
(without the red underlining if you have set up the new output column and got the input column by double-clicking on it’s name in the Column List box)
hope that helps,
Steve
Thanks a lot for the tips! The autocomplete is very helpful to find the corresponding library to import.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.