Problem with BAction

Denny Chambers <[email protected]> Fri, 15 Apr 2005 15:02:59 -0500
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi ALL

I have run across a problem in the BAction class. In my Barracuda 
webapp, I am sending all data to the browser as UTF-8, however my local 
Operating System which is running my webapp server may be in different 
character encoding formats, such as UTF-8, CP1252, ISO-8859-1, etc. Now 
when my OS is in UTF-8, I don't have any real problem sending extended 
characters (Characters outside of the ASCII range, i.e. greater than 
decimal 127). But when I am in a different code page like CP1252, I run 
into a problem sending extended characters in URLs created by 
BLink/BAction. In the method BAction.getAction(...) the parameter list 
is passed to the java.net.URLEncoder.encode(String s). For one, this 
method had been deprecated in favor of the 
java.net.URLEncoder.encode(String s, String enc) method which allows you 
to encode the String based on a particular character encoding format. 
Since Barracuda is using the older encode method, which takes no 
encoding parameter, the encoding is being done based on the JVM default 
encoding, which is set as a system parameter "file.encoding". This means 
the non-ASCII characters in my URL parameters are getting coded  using 
the byte sequence from the default OS character encoding, instead of the 
UTF-8 character encoding I want. It looks like the BAction classes need 
to allow for an encoding parameter to be specified, so that URL encoding 
is done properly.

FYI - The W3C recommends that character encoding be done based on a 
UTF-8 character set - 
http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars


Thanks,

-- 
=========================================================
Denny Chambers

Unix IS user friendly - it's just picky about it's friends.
smime.p7s (application/x-pkcs7-signature, 3.1 KB) - not displayed