Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charset on non-text content types (Internet Explorer) #17

Closed
kirasystems opened this issue Sep 17, 2012 · 1 comment
Closed

Charset on non-text content types (Internet Explorer) #17

kirasystems opened this issue Sep 17, 2012 · 1 comment

Comments

@kirasystems
Copy link

The current behaviour of the jetty adapter is to set charset=UTF-8 on every response. It turns out that doing this on image responses when HTTPS is being used causes IE7/8 (I think 9 as well, though didn't verify) to sporadically not display images (or very consistently in the case of IE7).

My temporary solution to this was to disable the charset in ring-jetty-adapter and instead use the following middleware:

(defn wrap-utf8
    "Wrap UTF-8 encoding only on text responses."
    [handler]
    (fn [req]
        (let [resp  (handler req)
              ctype (get-in resp [:headers "Content-Type"])]
                (if (and (> (count ctype) 5) (= (subs ctype 0 5) "text/" ))
                    (charset resp "UTF-8")
                    resp))))
@weavejester
Copy link
Member

In Ring 1.1.6 I've disabled any default charsets. Compojure and Noir supply their own charsets anyway for text/html responses, and Ring shouldn't be setting defaults in this case, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant