00001
00002
00003
00004
00005
00006
00007 #ifdef _ICU_
00008
00009 #include <stdlib.h>
00010 #include <string.h>
00011
00012 #ifdef __GNUC__
00013 #include <unixstr.h>
00014 #endif
00015
00016 #include <utf8arshaping.h>
00017
00018 UTF8arShaping::UTF8arShaping() {
00019
00020 conv = ucnv_open("UTF-8", &err);
00021
00022 }
00023
00024 UTF8arShaping::~UTF8arShaping() {
00025 ucnv_close(conv);
00026 }
00027
00028 char UTF8arShaping::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
00029 {
00030 UChar *ustr, *ustr2;
00031
00032 int32_t len = strlen(text);
00033 ustr = new UChar[len];
00034 ustr2 = new UChar[len];
00035
00036
00037 len = ucnv_toUChars(conv, ustr, len, text, -1, &err);
00038
00039 len = u_shapeArabic(ustr, len, ustr2, len, U_SHAPE_LETTERS_SHAPE | U_SHAPE_DIGITS_EN2AN, &err);
00040
00041 ucnv_fromUChars(conv, text, maxlen, ustr2, len, &err);
00042
00043 delete [] ustr2;
00044 delete [] ustr;
00045 return 0;
00046 }
00047
00048 #endif