Please submit it, with this comment attached, with the note that the
case where somebody specifies page-per-page encoding has to be addressed
too.
--
Ing. Leonardo Quijano Vincenzi
DTQ Software
Paul Cantrell wrote:
OK, after a head-spinning detour through the bowels of Tapestry, I've
found the problem.
Line 213 of AjaxDirectServiceImpl gets the content type from the
responseBuilder. DojoResponseBuilder has it hard-coded as "text/xml".
That content type then gets passed to webResponse.getPrintWriter(),
which passes the type on unmodified to ServletResponse.setContentType().
The javadoc for ServletResponse.getCharacterEncoding() informs us that
"If no charset has been assigned, it is implicitly set to ISO-8859-1"
-- but there is no ServletResponse.setCharacterEncoding() method.
Instead, both content type and encoding are set through
ServletResponse.setContentType().
So, by passing webResponse.getPrintWriter() a content type without a
charset, Tacos is forcing the response charset to be ISO-8859-1
regardless of Tapestry's settings. That is arguably a bug in Tapestry,
not Tacos, but internally Tapestry is very careful to append the
content type when calling getPrintWriter(), and Tacos should do the same.
The quick fix is to apply the global default output encoding:
RCS file:
/cvsroot/tacos/tacos4/src/java/net/sf/tacos/ajax/impl/AjaxDirectServiceImpl.java,v
retrieving revision 1.25
diff -r1.25 AjaxDirectServiceImpl.java
213c213,214
< ContentType ct = new
ContentType(responseBuilder.getContentType());
---
> ContentType ct = new
ContentType(responseBuilder.getContentType()
> + ";charset=" +
cycle.getInfrastructure().getOutputEncoding());
This fixes my problem.
It might be good to first get hold of the page, and check
page.getResponseContentType().getParameter(ENCODING_KEY) before using
the default, in the unlikely event that somebody has specified their
encodings on a page-by-page basis. But I'm sure this patch will cover
it for most people.
Do you need me to submit a bug report, or is this email sufficient?
Cheers,
Paul
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel