[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need BIDI help



On Wednesday 26 October 2005 14:37, Khalid Farouq wrote:

> Salamo Alikom,

Wa alaikum asalam wa rahmatullaah

> and so on, between each word I will insert into the buffer 202D.

trap the space between each word; if you want the space append to it,
if you don't want it then replace it \u202d.

Previously you wrote:

> I tried wprintf(L"Current Directory is \x202D  TEST TEST\n");

You might need to set the locale before doing that (see man setlocale).

Note that wprintf takes a const wchar_t* while "Buffer" is of type char.

In C++, I would do the following:

#include <iostream>
#include <string>
#include <locale>
using namespace std;

int main()
{

  string d("\xd8\xa7"); // letter Alif; Try Letter Ha: \xd8\xad
  // Change default locale to UTF-8 Arabic/Kuwait
  cout.imbue(locale("ar_KW.utf8"));
  cout << d << endl; // display alif.
  // or if you don't want to use the std::string
  cout << "\xd8\xa7" << endl;
}

I am using UTF-8 for Arabic/Kuwait. In C, you set that by passing this string to
LC_CTYPE (man setlocale).

Wishing you and your family peace and good health.


Salam,
Abdalla Alothman