Http-Get and encoding – the technical stone age

Every day another fuckup. Today it was encoding. Somehow our excel exports did not work for cities with umlauts. MUST be an encoding thing. Interesting: It did work pretty well on Jetty, but good ol’ Tomcat throwed me broken characters in my servletrequest.

I tried javascript escape and the result was that it didn’t even work in Jetty anymore. So after proper reading (http://jira.codehaus.org/browse/JETTY-113, http://jetty.mortbay.org/jetty5/faq/faq_s_900-Content_t_International.html), I accepted that you just CANNOT put umlauts in a get-request. You are able to escape it, but there is apparently no standard how the server retranslates it. But how to do it? First idea was to post it. Post uses the given encoding and all is fine. And why not doin’ it ajaxian? Well, because it just doesn’t work. The server is building the document and returns the binary data, but what do I do then? Tried putting it in a new document, but it just doesn’t work. After a few hours and some thousand curses, I ended up writing a hidden html-form, which looks really ugly, being the ONLY handwritten form in the whole javascript-driven application.

In short:

Never try to use special characters in Http-Get!

Forget using ajax to retrieve a file!