"Mark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Mark, > In my case servlet generates an output, so no JSP for now... > Can I do it using filters? Or define and store user's prefs with > encoding outside of tomcat and in the session and use if it's exists > in the session? > Other Mark's answer was a little incomplete. If your Servlet uses response.getWriter, then the spec requires that you get a charset on the Response headers. If your Servlet doesn't specify a charset in the response.setContentType, then a Filter something like:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException { if(request instanceof HttpServletRequest) { HttpServletRequest hreq = (HttpServletRequest)request; HttpSession session = hreq.getSession(); String enc = (String)session.getAttribute(MY_ENC_ATTR_NAME); if(enc == null) { enc = getCharSetForUser(hreq); // Your lookup from DB function if(enc != null) { session.setAttribute(MY_ENC_ATTR_NAME, enc); } } if(enc != null) { response.setCharacterEncoding(enc); } } chain.doFilter(request, response); } > Thanks a lot! > Mark. > > --- Mark Thomas <[EMAIL PROTECTED]> wrote: > >> Mark wrote: >> > Hello, >> > >> > In my application users enter data using different languages. >> > The problem I'm facing is the browser sets the page encoding >> always >> > to ISO-8859-1. (I guess this is default based on server OS) >> > >> > User can change encoding on the page (Browser settings) and >> > everything looks OK but only for one page. On the next page >> encoding >> > is back to ISO-8859-1. >> > Is there any way to instruct tomcat not to send the page >> encoding? >> >> If you are using JSPs, no. The spec requires that the charset is >> set. >> >> Mark >> >> >> >> > --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: >> [EMAIL PROTECTED] >> >> > > > > > > ______________________________________________________ > Yahoo! for Good > Donate to the Hurricane Katrina relief effort. > http://store.yahoo.com/redcross-donate3/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]