Convinced we tackled the character encoding issues in our webapplication by specifying everywhere UTF-8 and using Spring MVC nifty interceptor solution to set the contentype of the Response to UTF-8, I still found a character encoding issue in our webapplication. The problem appeared to be wrong paths of files, but as I dug deeper the cause lay in the solution to upload files where the name of the uploaded file would be used for the path. The name of the file got scrambled in the case special characters were used.
I used the CommonsPortletMultipartResolver class of the Spring MVC framework to handle the uploaded files. Wandering through Spring’s API I found out that their "Sensible Defaulting" paradigm led to adopt the Servlet spec default for the header encoding, which is ISO-8859-1.
Is it wrong to consider UTF-8 as the sensible default ? I know Sun has made some glitches with the Servlet spec, but I expected the Spring guys to be more pragmatic about encoding. I mean, aren’t we all trying to move to UTF-8 to overcome the character issues ? In the end the first responsibility is ofcourse with the developer using the Spring Framework, yep that’s me, to specifiy the desired encoding. So playing the blame game leads to my own humble me.