Click here to Skip to main content
13,833,081 members
Click here to Skip to main content
Add your own
alternative version


16 bookmarked
Posted 10 Apr 2006
Licenced CPOL

Persian Support for Windows CE

, 10 Apr 2006
Rate this:
Please Sign up or sign in to vote.
This article explains how to extend Mohamed Abdel-Monem's code for Arabic support for Windows CE, to add Persian support to your Windows CE programs.

Windows CE based terminal showing Persian words


An enhanced version of Arabic alphabet is used to write in Persian language. The enhancements include some additional symbols for displaying some Persian specific letters including Peh, Cheh, Zheh, Gaf, and a Persian version of Kaf.

A few months ago, I developed a simple data collection program for a Symbol MC3000 Windows CE 4.2 based terminal (you can read its specifications here [Persian]). I used a modified version of the code explained in Mohamed Abdel-Monem's Arabic support for Windows CE for adding Persian support to my program.

The reader is asked to refer to the original article for complete documentation, and I only explain my modifications to the original code here.


First of all, I defined N_DISTINCT_CHARACTERS somewhere in my code as below:


The ArabicReverse function needs no modifications.

Modifications in the Arabize function must be applied as below (only commented lines are added or changed):

CString Arabize (LPCTSTR in)
   static struct
        WCHAR character;
        WCHAR endGlyph;
        WCHAR iniGlyph;
        WCHAR midGlyph;
        WCHAR isoGlyph;
    {0x625, 0xfe88, 0xfe87, 0xfe88, 0xfe87},//,
    {0x6A9, 0xfb8f, 0xfb90, 0xfb91, 0xfb8e},//Persian Keh
    {0x6Af, 0xfb93, 0xfb94, 0xfb95, 0xfb92},//Gaf
    {0x698, 0xfb8b, 0xfb8a, 0xfb8b, 0xfb8a},//Zheh
    {0x686, 0xfb7b, 0xfb7c, 0xfb7d, 0xfb7a},//Cheh
    {0x67E, 0xfb57, 0xfb58, 0xfb59, 0xfb56}//Peh
      WCHAR ch=in[i];
        if((ch>=0x0621 && ch<=0x064a)||(ch==0x6A9)||(ch==0x6Af)
         ||(ch==0x686)||(ch==0x67E)) // is a Persian character?
    return out;

In the above code, we add five rows which include the state of Persian specific letters to the original Arabic letters' state array.

The following modifications must also be made to the isFromTheSet1 and isFromTheSet2 methods, to explain how our additional letters must be shown when they are linked to other letters:

BOOL BzArabicRender::isFromTheSet1(WCHAR ch)
    static WCHAR theSet1[27]={//changed from 22 to 27
        0x62c, 0x62d, 0x62e, 0x647, 0x639, 0x63a, 0x641, 0x642,
        0x62b, 0x635, 0x636, 0x637, 0x643, 0x645, 0x646, 0x62a,
        0x644, 0x628, 0x64a, 0x633, 0x634, 0x638,
        0x6Af, 0x6A9,    0x686, 0x67E, 0x626
        //our additional letters: Gaf, Persian Keh, 
        //Cheh, Peh, Yeh with hamza above
    int i = 0;
    while (i < 27)//changed from 22 to 27
        if(ch == theSet1[i])
            return TRUE;
    return FALSE;
BOOL BzArabicRender::isFromTheSet2(WCHAR ch)
    static WCHAR theSet2[13]={//changed from 12 to 13
        0x627, 0x623, 0x625, 0x622, 0x62f, 0x630, 0x631, 0x632,
        0x648, 0x624, 0x629, 0x649,
        0x698//our additional letter: Zheh
    int i = 0;
    while (i < 13)//changed from 12 to 13
        if(ch == theSet2[i])
            return TRUE;
    return FALSE;


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Hamid Reza Mohammadi
Software Developer
Iran (Islamic Republic of) Iran (Islamic Republic of)
No Biography provided

You may also be interested in...

Comments and Discussions

Generalthanks, and i need a keyboard Pin
aram_golbaghi18-Jul-10 23:09
memberaram_golbaghi18-Jul-10 23:09 
Generalthnx Pin
kavosh139-Oct-09 0:29
memberkavosh139-Oct-09 0:29 
GeneralGood Coding Pin
NNTBIZ24-Apr-09 22:05
professionalNNTBIZ24-Apr-09 22:05 
GeneralConverted to VB version of arabize function for persian support in win CE Pin
Ahmad Abrishami30-May-08 21:37
memberAhmad Abrishami30-May-08 21:37 
GeneralThanks Pin
javadpishvaei23-May-07 11:40
memberjavadpishvaei23-May-07 11:40 
NewsExcellent! Pin
A. Riazi12-Apr-06 20:13
professionalA. Riazi12-Apr-06 20:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.190114.1 | Last Updated 10 Apr 2006
Article Copyright 2006 by Hamid Reza Mohammadi
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid