0

I developed one Android application and set minSDK 14 (android 4.0 +). i want use UTF-8 characters (RTL language) . but when show this text instead of letters, question mark shows!!!

See this images to understand my mean : Image 1 ------ Image 2

An example of my codes :

mDrawerLayout.closeDrawer(GravityCompat.END);
String mobile_model = Build.MODEL;
String mobile_factory = Build.MANUFACTURER;
String mobile_android = Build.VERSION.RELEASE;
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"tellfa.group@gmail.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "5دقیقه - انتقاد و پیشنهاد");
email.putExtra(Intent.EXTRA_TEXT, "متن مورد نظر شما" + "\n\n\n\n\n" + "------------------" +
                    "\n" + "لطفا موارد زیر را پاک نکنید" +
                    "\n" +"مدل گوشی شما : " + mobile_model +
                    "\n" + "شرکت سازنده گوشی : " + mobile_factory +
                    "\n" + "نسخه اندروید شما : " + mobile_android);
            email.setType("message/rfc822");
            startActivity(Intent.createChooser(email, "سرویس دهنده را انتخاب کنید"));

how to fix it problem?

dashakhe.goli
  • 59
  • 2
  • 7
  • maybe this code will help you : https://fabioangelini.wordpress.com/2011/08/04/converting-java-string-fromto-utf-8/ – Itzik Samara Jun 26 '15 at 08:19
  • @ItzikSamara, tnx for your help. but don't work me :( – dashakhe.goli Jun 26 '15 at 08:36
  • ok use uri.encode(...) solution found here : http://stackoverflow.com/questions/8701634/send-email-intent – Itzik Samara Jun 26 '15 at 08:40
  • @ItzikSamara, Thank you, but I could not find good solutions.You can modify the code, and give me? its very important for me – dashakhe.goli Jun 26 '15 at 08:48
  • @ItzikSamara, i edit such as this : String share_title = Uri.encode("سرویس دهنده را انتخاب کنید"); . but dose not work again . shows for example : %3F%3F%3F... – dashakhe.goli Jun 26 '15 at 08:52
  • @dashakhe.goli %3F is a question mark so even the string constant is broken. I suspect the .java file is not in UTF-8. (In the screenshot you posted, the .java files were not visible.) – StenSoft Jun 26 '15 at 11:58
  • @StenSoft, how to set .java in UTF-8 ? can you help me ? – dashakhe.goli Jun 26 '15 at 12:07

1 Answers1

0

You must use the code to change the encoding of the text

for example :

String txt = URLEncoder.encode("5دقیقه - انتقاد و پیشنهاد", "UTF-8");
email.putExtra(Intent.EXTRA_SUBJECT, txt);

use this code for all Persian put extras

Majid Ahmadi Jebeli
  • 517
  • 1
  • 6
  • 22