struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fowler, Perryn" <Perryn.Fow...@anz.com>
Subject RE: Struts and arabic encoding
Date Mon, 13 Aug 2007 05:37:11 GMT



You seem to be trying all the right things, my advice is to try to
isolate where things are going wrong.. for example

1) Check what encoding your browser thinks the page is in ( usually
somewhere under the view menu )

2) Check whether you are managing to read the request parameter in the
correct encoding. 

This can be difficult because in order to check the value of a
parameter, you need to write it out somewhere, and this means
re-encoding it again.

For example, if you are writing out the parameter value to a windows XP
command prompt be aware that the encoding the prompt uses is different
to
The encoding windows uses for everything else, so you might find that
you are reading the parameter in just fine, but *writing it out* using
the wrong encoding.

To be sure, use the chcp command do determine the encoding your prompt
uses and then use an OutputStreamWriter to wrap System.out and set the
encoding to the same.

If all else fails, write out the raw bytes and see what they are in
Java's internal encoding (UTF-16)

2a) If you seem to be reading the parameter OK, then the problem might
be that you need to somehow specify the encoding to use when writing to
your database.

2b) If the parameter is being read in as garbage, check that something
else isn't reading from the request before your filter. If that happens,
the encoding used will have already been set and your filter will be
unable to change it.

Good Luck!
Perryn



"This e-mail and any attachments to it (the "Communication") is, unless otherwise stated,
confidential,  may contain copyright material and is for the use only of the intended recipient.
If you receive the Communication in error, please notify the sender immediately by return
e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit
or otherwise deal with it. Any views expressed in the Communication are those of the individual
sender only, unless expressly stated to be those of Australia and New Zealand Banking Group
Limited ABN 11 005 357 522, or any of its related entities including ANZ National Bank Limited
(together "ANZ"). ANZ does not accept liability in connection with the integrity of or errors
in the Communication, computer virus, data corruption, interference or delay arising from
or in respect of the Communication."

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message