• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Character encoding

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 C:Documents 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.

Regards,
Prakash.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic