DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24631>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24631

Struts tags use bytes of UTF-8 for urlencoding unconditionally

           Summary: Struts tags use bytes of UTF-8 for urlencoding
                    unconditionally
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Custom Tags
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Struts urlencodes non-ascii characters using bytes of UTF-8 unconditionally.

Although in the w3c's specification, UTF-8 is 'recommended' as
character encoding method for non-ascii url string, this approach is not
feasible in many case. Consider following scenario.

I have a url that handle a search query. The pages of the site are
character encoded in some encoding ,say, EUC-JP, so the POST request comes in 
EUC-JP encoding. I want the url to handle both GET request and POST request, so
that I can embed a search string within href of some anchor elements. I
think this is very common scenario.

Now, when I use struts' html:forward tag, it is not possible because the
GET request comes character-encoded in UTF-8, because the taglib uses
UTF-8, and the POST request, from form submission, comes in EUC-JP
because the page itself is encoded in EUC-JP. Same url, same request
parameter, but different bytes... And when the request comes in, there
is no reliable way to tell what character encoding system should be used
to decode the incoming bytes.

So I think it makes more sense for tags like html:forward, html:rewrite
and html:image to have option to specify either to use local encoding 
(obtained from HttpResponse#getCharacterEncoding) or to use UTF-8 as
encoding method to get bytes.

Right now, I am setting ServletRequest#setCharacterEncoding to UTF-8 if the 
request method is 'GET', settting it to EUC-JP if the method is 'POST'. This is 
only possible because I am not using 'GET' for fom submission and can break if 
I need to change it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to