Arabic alphabets

Help needed fellows...
I want to input and display arabic alphabets using Dev C++. I have tried using ascii codes but failed. How can i???
You mean via console window? In which OS? On Windows should be almost impossible
BTW you should use Unicode, not ASCII
Hi,

Arabic is not part of the ASCII. Hebrew and Arabic are the only 2 languages that are written from right to left, and are discribed well in UNICODE. Every character is 2 bytes, while ASCII is 1 byte char.

http://www.unicode.org/

You can use the BIDi-Algorith to embedd arabic and english always , and controll the cursor positions.
Thanks bazzy and waelali. i have unicode ranging from 0600 to 06FF. I don't know how to use it as i am a beginner. I will be pleased if you can guide me with an example. Thanks to everyone.
I am using windows.
Last edited on
You need to set the console code page to 65001 and the font to "Lucida Console" (I think that has Arabic characters -- I know it does not have Hebrew characters). This will allow the console to read and display your Arabic characters.

I've never messed with a Right-To-Left language like Arabic or Hebrew on the console before, so I don't know what else needs to be done to accomodate it.

I think you'll also need to change the current system locale.

There are these links I found:
http://www.microsoft.com/middleeast/arabicdev/Windows/winMEDIA/wPapers_mediaServices.aspx
http://msdn.microsoft.com/en-us/library/dd318054(VS.85).aspx

That last link is somewhat disappointing, but it is noteworthy also that perhaps you'll want some other output medium to display your text...

That's all I know. Hope it helps.
Thanks Duoas. Still some help needed.... Current CP identifier is 437. I want it to be 864. I wrote following code but it failed.
1
2
3
4
5
6
7
8
9
10
11
12
13
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
      int a=864;
      if ((SetConsoleCP(a)==0))
      cout<<"CP not changed."<<endl;
      else
      cout<<"CP changed to "<<a<<endl;
      system("PAUSE");
      return 0;
}

SetConsoleCP() requires UINT, unsigned int as input.
It's working fine for me. The only thing I can think of that could go wrong is that you're not using one of the NT kernels (post Windows 2000).
I am using windows XP and Dev C++. How to use NT kernels and why?
http://en.wikipedia.org/wiki/Windows_NT
First paragraph should clear that up for you

SetCurrentConsoleFontEx() only works on Vista and later

int -> unsigned int is an implicit conversion

It's failing for me as well. GetLastError returns "The parameter is incorrect."

Ok so I read SetConsoleCP's parameter and noticed the code pages are stored in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage so I open up regedit and head to the key.

I see the values and look for 864 yet it doesn't have any data ;) I noticed my 863 DID IN FACT have data (c_863.nls)

I changed the value to 863 and it worked. So I've concluded that because there is no data in 864 it failed. I'm very interested in this thread could someone please help me with this too?

Should have looked through Duoas's links before posting =]
Last edited on
But it works for helios. What should i do to make it work for XP?
Read http://www.microsoft.com/middleeast/arabicdev/Windows/winMEDIA/wPapers_mediaServices.aspx (Duoas posted this)

It works for helios because he has the language pack installed (I assume that's why and I don't actually have my windows xp installer disc right now to try it out)
Last edited on
But arabic alphabets have ASCII codes in CP 864. I want that. Thanks mackabee. Now CP changes to 864 but no change in alphabets. Is it necessary to change the whole configuration of OS to arabic??? I just want to input and display some arabic alphabets in C++ console window.
Last edited on
Is there no solution for my problem.....
Alas, not that I know of...

The Windows Console really isn't designed for Arabic text.
you mean i should use another language...
No, I mean that you should display your text on something other than the console.

The western world has been fairly Anglo-centric about languages used in computing. Just getting things like diacritics for languages like EspaƱol is a hassle -- messing with code pages and the like.

Arabic has several things working against it when working in such a narrow view of the world:
-- it is read right-to-left
-- its letters change shape depending on adjacency (they are connected --unlike in European languages where each letter is a thing by itself)

The Windows Console simply isn't designed to be able to handle right-to-left scripts like Arabic and Hebrew. However, while googling for information to help you, I have come across a number of sites dedicated to using Hebrew in the console. These may help you. You'll just have to change the font to display Arabic glyphs rather than Hebrew. (Hebrew also has some letterform changes based upon its location in a word -- though they don't ever connect together.)
Last edited on
Thanks Duoas, you have helped me a lot in this problem. And thanks to all.
Topic archived. No new replies allowed.