I am trying to paste Hindi characters in an array with elements like
String[] arr = {"आपका स्वागत है","आपका स्वागत है"};
but its giving error i.e.
"some characters cannot be mapped using "Cp1252" character encoding"
while saving this.
Asked
Active
Viewed 8,790 times
5
4 Answers
4
Switch your text encoding to UTF-8.
In Eclipse go to Window -> Preferences, select General -> Workspace. From the Text file encoding dropdown, select UTF-8.

Jacob Ewald
- 2,133
- 18
- 19
-
i tried with this but it disturb the others language formates like spanish, italian, french... – Gkapoor May 02 '11 at 13:56
-
Make sure the file is being saved as UTF-8. Go to File->Properties and check the Text file encoding property. – Jacob Ewald May 02 '11 at 16:23
3
Thanks i found the solution...
- create an array under the value folder
- Use the font that support Hindi under the assets folder
textview.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/Hindi.ttf"));
its working fine...

Paresh Mayani
- 127,700
- 71
- 241
- 295

Gkapoor
- 840
- 1
- 13
- 27
0
You need UTF-8 encoding, not Cp1252, and Unicode.

duffymo
- 305,152
- 44
- 369
- 561
-
i tried with this but it disturb the others language formates like spanish, italian, french... – Gkapoor May 02 '11 at 14:19
0
Thanks i found the solution...
Create an array under the value folder
Use the font that support Hindi under the assets folder
textview.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/Hindi.ttf"));
its working fine...

Naresh Sharma
- 4,323
- 7
- 48
- 68

Gkapoor
- 840
- 1
- 13
- 27