You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Baroukh <mb...@cardiweb.com> on 2007/01/03 10:44:51 UTC

Sitemesh and utf-8

Hi again.

I'm using Resin.
I made a jsp located at a path where no decorator for Sitemesh is defined.

Il this jsp doesn't return any accent, it works correctly.
But If the jsp returns an accent, I got :
[10:27:50.032] java.lang.IllegalStateException: 
http://localhost/accent/accent.do: tried to write 1346 bytes with 
content-length 1316 (At 'f', char=102).
[10:27:50.032]     at 
com.caucho.server.connection.ResponseStream.lengthException(ResponseStream.java:551)
[10:27:50.032]     at 
com.caucho.server.connection.ResponseStream.setBufferOffset(ResponseStream.java:362)
[10:27:50.032]     at 
com.caucho.vfs.i18n.UTF8Writer.write(UTF8Writer.java:155)
[10:27:50.032]     at 
com.caucho.server.connection.ToByteResponseStream.flushCharBuffer(ToByteResponseStream.java:469)
[10:27:50.032]     at 
com.caucho.server.connection.ToByteResponseStream.flushBuffer(ToByteResponseStream.java:422)
[10:27:50.032]     at 
com.caucho.server.connection.ResponseStream.flush(ResponseStream.java:582)
[10:27:50.032]     at 
com.caucho.server.connection.ResponseStream.flushChar(ResponseStream.java:630)
[10:27:50.032]     at 
com.caucho.server.connection.ResponseWriter.flush(ResponseWriter.java:180)
[10:27:50.032]     at 
com.opensymphony.module.sitemesh.filter.PageFilter.writeOriginal(PageFilter.java:192)
[10:27:50.032]     at 
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:67)
[10:27:50.032]     at 
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
[10:27:50.032]     at 
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)
[10:27:50.032]     at 
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
[10:27:50.032]     at 
com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:420)
...

and the jsp is not printed completly (I got </   at the end instead of 
</body></html> ...).


If I disable completly Sitemesh filter, no more exception and the 
content is correctly redered.

So it seem that when no decorators are defined, Sitemesh change 
content-length with a wrong value ....

Just a question : I decided to build my application entirely in utf-8. 
Have any body done the same ? Does it work correctly ? I wanted to do 
this for having no more encoding problems. It seem to be the right 
solution because utf-8 can represent any character. But finally, I got a 
lot of problems ....

-- 

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: mbaroukh@jabber.org
http://www.cardiweb.com
---