8

I want to write Persian in Android Studio, but after typing Persian, Android Studio shows some strange characters. Of course it was right for about 3 months, but suddenly it's strange.

enter image description here

Cœur
  • 32,421
  • 21
  • 173
  • 232
amir omidi
  • 121
  • 7
  • Are you sure this isn't just an encoding problem or that the font doesn't have glyphs for these characters (seeing how the tooltip can display it correctly)? What if you run the app – are they displayed correctly? – Ingo Bürk Apr 26 '15 at 08:53
  • use string resources for strings. then it will be ok. – Amir Ziarati Aug 16 '17 at 11:29
  • 1
    Hey @Cœur, just the title caught my eye on this. Sure, I saw it, thanks. – Salek Aug 07 '19 at 12:30

5 Answers5

4

In android studio 1.2 you should go to configure> settings> colors and fonts> font> use your scheme> uncheck show only monospaced fonts> and finally use tahoma font and apply and ok. Enjoy it!

Instruction

1

In Android Studio go to settings--> editor--> font and colors--> font, check the "secondary font" checkbox and define a Farsi font from the list like "Nazanin". Also, uncheck the "show only monospaced font".

Nasser Tahani
  • 626
  • 10
  • 24
0

In android versions later than 3, you don't need anything but in earlier versions you must add Farsi.java to your app and in the code write text as follow:

MyTextView = (TextView) findViewById(R.id.MyTextView);

Typeface tf = Farsi.GetFarsiFont(this);
MyTextView.setTypeface(tf);
MyTextView.setText(Farsi.Convert("سلام"));

you cann't write farsi text in xml files in earlier versions!!! so I suggest to use newer versions of android.

Mahmoud
  • 883
  • 7
  • 16
0

select your project in android studio and go to File/Setting menu. in the opened page point to File Encodings option and in that tabbed ensure IDE Encoding is UTF-8

Mahmoud
  • 883
  • 7
  • 16
-1

For Android Studio 1.5 in Windows create file with name "idea.properties" in
C:\Users\.AndroidStudio1.5
and write this in the file:

editor.new.rendering=true
Mneckoee
  • 1,833
  • 5
  • 16
  • 29