Hi,
we ran into trouble with the StringRequestTarget on Wicket 1.4-m3, when our
system file.encoding was different from the encoding used for the
communication between Wicket and the web browser. In short, we use UTF-8 for
our web pages and JSON. Java uses Cp1252 as file encoding on one of our
machines, so the CharSet of the OutputStream used by StringRequestTarget is
set to Cp1252 as well.
The StringRequestTarget sets the content type to "text/charset=utf-8" by
default (possibly because the request is encoded in UTF-8 ?).
Setting a the content type parameter of the StringRequestTarget to
"application/json; charset=UTF-8" does not change the charset used by the
OutputStream, so you will send corrupt data. I don't think that the content
type should be set to "...;charset:cp1252" - if the web pages and the
request are UTF-8, the response should be UTF-8 as well.
Right now we are overloading StringResourceTarget (= cutting and pasting the
whole class, then applying our changes), so that we have a new constructor:
> public MyStringRequestTarget(String mimeType, String string, Charset
charset) { ... }
The charset is stored in a member variable and used in in onResponse():
> MyStringRequestTarget.onResponse()
> {
> ...
> stream.setCharset(charset);
> response.setContentType(mimeType + ";charset=" + charset.name());
> ...
> }
Could these changes be applied to Wicket / trunk 1.4?
Or am I missing something obvious?
Niels
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]