I think I found the problem after digging in the source code.
If I use StringRespresnetation this way: result = new StringRepresentation(res, MediaType.TEXT_HTML); result.setMediaType(MediaType.TEXT_HTML); result.setCharacterSet(CharacterSet.UTF_8); It doesn't work - because the protected method updateSize() in the StringRepresentaion is not called if I use the setCharacterSet after representaion is created. However, It is called when I use this constructor: StringRepresentation(CharSequence text, MediaType mediaType, Language language, CharacterSet characterSet) The latter constructor updates correctly the content length. Regards, Svi 2007/6/26, Svilen Ivanov <[EMAIL PROTECTED]>:
Hi, I'm building StringRepresentation containing non-English characters in UTF-8 encoding. The problem is that the Content-Length header of the response counts the "characters" in the string instead of "bytes". As you know for non-English characters are represented by 2 bytes. This makes the length shorter and the client truncates the response. I tried with both curl tool and firefox browser. If I manually set the representation content, it works fine - the content is not truncated. Do you guys have encountered the problem before? I googled around but with no luck Regards, Svi P.S. I'm going to present REST architectural style to Annual Conference for Web Technologies in Bulgaria - WebTech '07 (http://www.wtconferences.com/2007/?q=node/14) and I'll use Restlet application as demo application.

