Uft-8 encoded scaml doesn't render right
Considering the template below:
I can't get the greek work right. As I can see from the generated source code the greek characters was escaped, so I used
I had similar problems with groovy and -Dfile.encoding=UTF-8 did solve the problem so I made sure this system property had UTF-8 as value.
!!!
%html
%head
%title Some title
%body
%p Some text in greek (Καλησπέρα)
I can't get the greek work right. As I can see from the generated source code the greek characters was escaped, so I used
= "Some text in greek (Καλησπέρα)"
instead and the generated scala file did have the right characters. Still in both situations I can't get the template get rendered right (the output html contains ? instead of greek characters).I had similar problems with groovy and -Dfile.encoding=UTF-8 did solve the problem so I made sure this system property had UTF-8 as value.
Leave a comment
Ok, As I had some problems building scalate from source the last time I tried, I just subclassed the TemplateEngineFilter with something like:
and solved the problem! In this case I could also just put
Am I the only one who has problems with encoding?
public class FixedScalateTemplateFilter extends TemplateEngineFilter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {
response.setCharacterEncoding(request.getCharacterEncoding()); // Just fixed the character encoding!
super.doFilter(request, response, chain);
}
}
and solved the problem! In this case I could also just put
response.setCharacterEncoding("UTF-8");
, but I think that setting the response character encoding to the requested one should do the trick as in most cases we expect to have a response encoded just like the request.Am I the only one who has problems with encoding?