Hello, all.

Had a problem. Solved it. Now going to tell you about it =)

Environment:
Orion 1.3.8 using XML+JSP+XSL to generate HTML using XSLTServlet (from the old
OrionSupport.com) with SAXON (and xerces/xalan whichever wasn't replaced)

Problem:
Japanese characters in an HTML form when passed to a servlet in Orion (and then
put into a database) were garbled.

Solution:
I read in the FAQ about setting the default-charset in the orion-web.xml file..
but when we set this (to UTF-8) the whole xml+xsl chain broke down... but sometimes it
DIDN'T break down and it would work...

The problem was two things... first the jspcache was being kept if you just
change the default-charset.. so if the pages were already generated... and Orion
was NOW using the new charset.. then they worked..

But if you remove the cache and the pages are re-generated... the XML+XSL chain
breaks.. and the user just gets fed the XML. Which is just wrong wrong wrong. =)

This cache problem MAY or MAY NOT be a bug... I guess it is since changing the
character set of the generated pages should cause them to be re-generated.
Thoughts?

We discovered the problem is that the servlet-chaining is based off of the
mime-type for the in-progress generated page... before setting default-charset
it was (text/xml) and the page was correctly passed to the XSL servlet... but
after setting default-charset to UTF-8... the mime-type now appears as
(text/xml;charset=utf-8) ... and is never passed to the XSL Servlet (since it
doesn't match to one of the specified servlet chaining elements).

The fix? Add a new servlet-chaining parameter to your global web application xml file
like so :
  [ global-web-application.xml ]
      <servlet-chaining servlet-name="xsl" mime-type="text/xml" />
      <servlet-chaining servlet-name="xsl" mime-type="text/xml;charset=utf-8" />

The first line already existed.. and the second one if for this new occurence..
you would add in whatever charset you are using... mind you this only applies if
you are passing along to XSL of course =)

Maybe I don't need two... and just a * would work. Eg: (text/xml*) ? Maybe I'll
give it a try...

The problem might be occuring since Orion passes the mime-type with the charset
WITHOUT a space in between... and with a space it would still work fine. BUt I
can't check this...

A full day of hair pulling out finally figured out. Hope this can help someone
else and prevent them from pre-mature baldness =)

There are also about three or four other internationalization issues and
problems that we solved.. but I thought I would mention this one since it
relates to Orion. If you are having internationalization problems then maybe I
can give you some advice.

Thanks,
Dylan Parker



Reply via email to