Essentially, you gave it a string (UTF16 in memory), and it is being converted into bytes ( string.getBytes() within TextStreamResponse ). And the contentType of the response is set also from TextStreamResponse.
I would double check what the string.getBytes() is returning, maybe it's actually putting out bytes in UTF-8, but the HTTP response assumes it's not in UTF-8, but ISO-LATIN-1 or somesuch. So you're getting the correct bytes, but they are being interpreted wrong.. 1) you might just have to add the charset to the mimetype.. "text/xml;charset=UTF-8"? 2) If you want your 3rd party library to take over more rendering, then create StreamResponse object that goes from a byte[] instead of a String, then you have full control on how that strings gets encoded (utf-8 charset). 3) Maybe there is a bug/enhancement here and StreamResponseResultProcessor, and TextStreamResponse should be paying more attention to the charset of the mimetype. thanos wrote: > I used > boolean beforeRenderTemplate(){ > return false; > } > but couldn't skip rendering check > > I will currently return xml using a template with the help of Fernando's > patch - TAPESTRY-1600. > This patch allows the generation of xml, from an xml-based description by > fixing the "cutting" of namespaces from tapestry. This way I a can set and > keep UTF-8 encoding. > > I would like, however, to have the option to return a complete UTF-8 xml/rss > created from say another library (I am currently using rome), using > TextStreamResponse or Printwriter, so if anyone has a code example that will > actually perform my original request, please post it here. > > > > > > Vashon-Ez wrote: >> You can override one of the page render methods (I think onactivate is one >> of those, but check the Tap5 website) and return false !!!! to tell Tap to >> skip the other steps of page rendering. >> >> thanos <[EMAIL PROTECTED]> wrote: >> thank you. >> >> I tried that but I get a mix of xml and html erro String (insteαd of >> clean >> xml document) as a response. Seems that it looks for a template (I dont >> have >> one cause I didnt need it with textStreamResponse) >> >> Inside onActivate I obtain a PrintWriter from the injected Response, using >> "application/xml; charset=UTF-8" >> as content type. I print a small test xml string in printwriter and then I >> flush the printwriter. >> >> I return null in onActivate(). >> >> Did I do something wrong? >> >> >> >> >> >> Vashon-Ez wrote: >>> If you're just returning an RSS feed you probably don't want any page >>> wrapping, etc. In that case you can: >>> >>> @Inject >>> private Response _response; >>> >>> You can then do things like setting headers and even write directly to >>> the >>> container-provided OutputStream - bypassing the whole TextStreamResponse >>> -- just have your method flsuh() the output stream and return null. This >>> should also give slightly better performance. >>> >>> HTH, >>> >>> EE >>> >>> thanos wrote: >>> Hi all, >>> >>> I am trying to return an rss feed using TextStreamResponse("text/xml", >>> myfeed); >>> >>> The problem is the that I can't make TextStreamResponse to show UTF-8 >>> (greek >>> in my case) characters. >>> I tried to set the content type in the response of RequestGlobals and >>> also >>> added a Utf8Filter with no luck >>> >>> The same feed is displayed fine when I requested through a simple >>> servlet. >>> I can see the characters in the returned string, and if I save the page >>> source as an UTF-8 file I can displayed it correctly. >>> >>> However, I can't make my browser or my GUI to display the xml if I >>> directly >>> request it using TextStreamResponse. >>> >>> Dont know if it's related with this post: >>> >>> http://www.nabble.com/T5-confused-about-Services-and-XmlHttpResponse-tf4160459.html#a11839004 >>> >>> Any advice plz? >>> >>> Thanks >>> Thanos >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/TextStreamResponse-and-XML-and-UTF-8-tf4799847.html#a13732229 >>> Sent from the Tapestry - User mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >> -- >> View this message in context: >> http://www.nabble.com/TextStreamResponse-and-XML-and-UTF-8-tf4799847.html#a13736449 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]