This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
In our application we have to provide the user with an option to select a destination directory to download files from server. To enable this I have developed a signed applet to enable the user to select the destination directory.
The applet displays a directoy selection box, user selects the required destination directoy and then the applet sets the destination directoy string to a html hidden form field.
When the user submits the page this destination directory is then used by the application to download files to that directory.
The application works fine when the character encoding is windows-1252, MacRoman or ISO-8859-1.
However, the system doesnt function properly when any user selects a directory thats in japanese language. To fix this i have changed the jsp pages character set encoding to UTF-8 from IS0-8859-1. With this change, the destination directory path string gets currupt when its transfered from applet to html hidden form field. The characters after the "\" character (windows path separation character) are interpretted as escape sequences and the string looses the actual path info.
e.g. C:\Documents and Setting\113XXX\Desktop\test changes to Cocuments and SettingskXXXDesktop est
As per my understanding this should have been automatically handled by java while changing the character set encoding.
I have tried to change the character encoding by picking the default character encoding of the system to UTF-8 using the nio classes.
Request the members of the forum to help me find a solution to this.
Thanks in advance for any solutions or suggession.
You can try to re-encode the String containing the path in your applet by using the String constructor that takes the encoding as second argument. This way you do not depend on the encoding of the client's system.
Re-encode the String before passing it to your html form. Use the same encoding for your jsp.