bookmark_borderQuery string white space vs plus

Trivia: What is the difference between the encoded query string parameter “a+b” and “a%20b” ?

Answer: Nothing! They are both encoded representations for “a b”.

Isn’t a “+” supposed to remain a “+”? Well, the URL and the query strings are not encoded following the same rules. In the URL, the “+” remains a “+” indeed, but in the query string it’s actually encoded and becomes a “%2B”. This can be misleading.
Continue reading “Query string white space vs plus”

bookmark_borderGenerating a downloadable file from JavaScript

Recently, a friend asked me if I could help him with a very simple task: have a dialog with an input text field where he could paste some csv lines and press a “save” button that would reformat the csv and write it to a file.

I thought that the input text field and the reformatting could be done very easily with a web page and a few JavaScript lines, but I was afraid I wouldn’t be able to save anything back to the disk without having some sort of server to serve the final result.

Continue reading “Generating a downloadable file from JavaScript”