that is something the PrintWriter does for you.
But i don't know if i am willing to first generate a complete byte[] of that string to get the length
and then get the Writer and print the stream..

Maybe there is some tool like:

strings.calculateSize(string, encoding)

That runs through all the chars.
But then you have 2 times an char encoding in one response (and that is expensive)

Maybe we should convert it in mem then don't use the PrintWriter but the outputstream directly...

Jan Bares wrote:
You cannot calculate size of the string in bytes? I am not Java expert, but this must be easy.
 
Jan
"Johan Compagner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]...
how can we made that reliable ??
Because utf-8 can be 8 bits or 16 or i think 24 per char. Depending on what it really needs..

What does for example a JSP do it its servlet generated form if you use UTF-8??
Or doesn't he set anything?

Reply via email to