Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7571563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:42:16+00:00 2026-05-30T15:42:16+00:00

I am using some arabic text in my app. on simulator Arabic Text is

  • 0

I am using some arabic text in my app. on simulator Arabic Text is diplaying fine.

BUT on device it is not displaying Properly.

On Simulator it is like مَرْحَبًا that.

But on device it is like مرحبا.

My need is this one مَرْحَبًا.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:42:17+00:00Added an answer on May 30, 2026 at 3:42 pm

    Create text resources for a MIDP application, and how to load them at run-time. This technique is unicode safe, and so is suitable for all languages. The run-time code is small, fast, and uses relatively little memory.

    Creating the Text Source

    اَللّٰهُمَّ اِنِّىْ اَسْئَلُكَ رِزْقًاوَّاسِعًاطَيِّبًامِنْ رِزْقِكَ
    مَرْحَبًا
    

    The process starts with creating a text file. When the file is loaded, each line becomes a separate String object, so you can create a file like:

    This needs to be in UTF-8 format. On Windows, you can create UTF-8 files in Notepad. Make sure you use Save As…, and select UTF-8 encoding.

    enter image description here

    Make the name arb.utf8

    This needs to be converted to a format that can be read easily by the MIDP application. MIDP does not provide convenient ways to read text files, like J2SE’s BufferedReader. Unicode support can also be a problem when converting between bytes and characters. The easiest way to read text is to use DataInput.readUTF(). But to use this, we need to have written the text using DataOutput.writeUTF().

    Below is a simple J2SE, command-line program that will read the .uft8 file you saved from notepad, and create a .res file to go in the JAR.

    import java.io.*;
    import java.util.*;
    
    public class TextConverter {
    
        public static void main(String[] args) {
            if (args.length == 1) {
                String language = args[0];
    
                List<String> text = new Vector<String>();
    
                try {
                    // read text from Notepad UTF-8 file
                    InputStream in = new FileInputStream(language + ".utf8");
                    try {
                        BufferedReader bufin = new BufferedReader(new InputStreamReader(in, "UTF-8"));
                        String s;
                        while ( (s = bufin.readLine()) != null ) {
                            // remove formatting character added by Notepad
                            s = s.replaceAll("\ufffe", "");
                            text.add(s);
                        }
                    } finally {
                        in.close();
                    }
    
                    // write it for easy reading in J2ME
                    OutputStream out = new FileOutputStream(language + ".res");
                    DataOutputStream dout = new DataOutputStream(out);
                    try {
                        // first item is the number of strings
                        dout.writeShort(text.size());
                        // then the string themselves
                        for (String s: text) {
                            dout.writeUTF(s);
                        }
                    } finally {
                        dout.close();
                    }
                } catch (Exception e) {
                    System.err.println("TextConverter: " + e);
                }
            } else {
                System.err.println("syntax: TextConverter <language-code>");
            }
        }
    }
    

    To convert arb.utf8 to arb.res, run the converter as:

    java TextConverter arb
    

    Using the Text at Runtime

    Place the .res file in the JAR.

    In the MIDP application, the text can be read with this method:

      public String[] loadText(String resName) throws IOException {
        String[] text;
        InputStream in = getClass().getResourceAsStream(resName);
        try {
            DataInputStream din = new DataInputStream(in);
            int size = din.readShort();
            text = new String[size];
            for (int i = 0; i < size; i++) {
                text[i] = din.readUTF();
            }
        } finally {
            in.close();
        }
        return text;
    }
    

    Load and use text like this:

    String[] text = loadText("arb.res");
    System.out.println("my arabic word from arb.res file ::"+text[0]+" second from arb.res file ::"+text[1]);
    

    Hope this will help you. Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using some features that are provided in GCC v4+ and would like
I am using Samsung Galaxy Tab and my app contains displaying Arabic texts. I
I have a php page which supports arabic text properly. I am using ajax
I'm working on an application that requires arabic text to be displayed, using custom
I am implementing a book for Kindle device using HTML, but some Unicode special
Assume you are using some libraries like NHibernate or Castle ActiveRecord that use log4net
I've been using some basic AOP style solutions for cross-cutting concerns like security, logging,
I am using some custom controls one of which is a tooltip controller that
I'm using some meta-programming to generate a bunch of methods in ruby like so:
I'm using some embed codes that insert HTML to the page dynamically and since

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.