encoding - Storing hindi in lang.properties in java and retrieving it -


i want read hindi text lang.properties(java.util.properties) file. using eclipse ide.

first of how can save(or write) hindi letter in .properties file

secondly how read string java class.

lang.properties

hinditext=साहिलसाहिल 

java class

properties prop = new properties(); prop.load(mycalss.class.getclassloader().getresourceasstream("lang.properties")); string hindi=prop.getproperty("hinditext"); 

it's not working.

as documented, properties.load(inputstream) use iso-8859-1 encoding, , encoding doesn't handle characters you're interested in.

options:

  • wrap stream in inputstreamreader , specify encoding explicitly
  • use unicode escaping (e.g \u1234) in file characters not in iso-8859-1 (and make sure file saved iso-8859-1)

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -