Re: Correct way of setting charset
Don't know that if is it the most correct way or not, but it works. My dotted letters are now working. But this option applies only to markup? What about other content(like JSON)? Sigmar On Sun, Jul 4, 2010 at 7:31 PM, Antoine van Wel wrote: > Maybe this is what you need, in your WebApplication's init method : > > getMarkupSettings().setDefaultMarkupEncoding("UTF-8"); > > > > > On Fri, Jul 2, 2010 at 9:29 AM, Sigmar Muuga wrote: > > > Hello, > > what is the correct way of setting my pages charset? > > > > I did something like this and it didnt have any effect: > > @Override > > protected void configureResponse() { > > super.configureResponse(); > > final String encoding = "text/" + getMarkupType() + "; charset=UTF-8"; > > getResponse().setContentType(encoding); > > } > > > > I want to set everything in UTF-8. > > > > Also, when I did something like this(like it is said in docs, I got > error: > > final String encoding = "text/" + getMarkupType() + "; charset=" + > > CharSetUtil.getEncoding(getRequestCycle()); > > getResponse().setContentType(encoding); > > > > And the error: > > java.lang.IndexOutOfBoundsException: Index: 4, Size: 0 > > at java.util.ArrayList.add(ArrayList.java:367) > > at > > > > > org.apache.wicket.extensions.util.encoding.CharSetMap.(CharSetMap.java:238) > > at > > > > > org.apache.wicket.extensions.util.encoding.CharSetUtil.initialize(CharSetUtil.java:72) > > at > > > > > org.apache.wicket.extensions.util.encoding.CharSetUtil.getEncoding(CharSetUtil.java:102) > > > > > > Sigmar > > >
Re: Correct way of setting charset
Maybe this is what you need, in your WebApplication's init method : getMarkupSettings().setDefaultMarkupEncoding("UTF-8"); On Fri, Jul 2, 2010 at 9:29 AM, Sigmar Muuga wrote: > Hello, > what is the correct way of setting my pages charset? > > I did something like this and it didnt have any effect: > @Override > protected void configureResponse() { > super.configureResponse(); > final String encoding = "text/" + getMarkupType() + "; charset=UTF-8"; > getResponse().setContentType(encoding); > } > > I want to set everything in UTF-8. > > Also, when I did something like this(like it is said in docs, I got error: > final String encoding = "text/" + getMarkupType() + "; charset=" + > CharSetUtil.getEncoding(getRequestCycle()); > getResponse().setContentType(encoding); > > And the error: > java.lang.IndexOutOfBoundsException: Index: 4, Size: 0 > at java.util.ArrayList.add(ArrayList.java:367) > at > > org.apache.wicket.extensions.util.encoding.CharSetMap.(CharSetMap.java:238) > at > > org.apache.wicket.extensions.util.encoding.CharSetUtil.initialize(CharSetUtil.java:72) > at > > org.apache.wicket.extensions.util.encoding.CharSetUtil.getEncoding(CharSetUtil.java:102) > > > Sigmar >
Correct way of setting charset
Hello, what is the correct way of setting my pages charset? I did something like this and it didnt have any effect: @Override protected void configureResponse() { super.configureResponse(); final String encoding = "text/" + getMarkupType() + "; charset=UTF-8"; getResponse().setContentType(encoding); } I want to set everything in UTF-8. Also, when I did something like this(like it is said in docs, I got error: final String encoding = "text/" + getMarkupType() + "; charset=" + CharSetUtil.getEncoding(getRequestCycle()); getResponse().setContentType(encoding); And the error: java.lang.IndexOutOfBoundsException: Index: 4, Size: 0 at java.util.ArrayList.add(ArrayList.java:367) at org.apache.wicket.extensions.util.encoding.CharSetMap.(CharSetMap.java:238) at org.apache.wicket.extensions.util.encoding.CharSetUtil.initialize(CharSetUtil.java:72) at org.apache.wicket.extensions.util.encoding.CharSetUtil.getEncoding(CharSetUtil.java:102) Sigmar