Lev писал(а):
The first thing you should try to achive is to output text to the client screen so it looks as required.
Код:
MultiByteToWideChar(said, said_to_utf16)
if(isArabic(said_to_utf16)) {
ReverseString(said_to_utf16)
WideCharToMultiByte(said_to_utf16, said_to_utf8)
for( new i; i < sizeof Separate_letters_Symbol ; i++ ) {
replace_all(said_to_utf8, charsmax(said_to_utf8), Separate_letters_Symbol[i], Connected_letters_Symbol[i]);
}
In this part of the above code I actually captured the chat line as I should see it (
said_to_utf8)
(the position of the letters in the word and the position of the words were converted from right to left, then the non-connected letters were replaced and converted to connected letters in the word)
Lev писал(а):
For that I advise you to move to the byte level. If you see that at least part of the sentence looks correctly - capture it and analyze the byte order. Check the end letter case, probably you will be able to add some bytes (text, spaces, dots) so the last letter will appear not separated.
Код:
new last_leter[192]
getLastChar_UTF8(last_leter, charsmax(last_leter), said_to_utf8)
for( new i; i < sizeof Connected_letters_Symbol ; i++ ) {
replace_all(last_leter, charsmax(last_leter), Connected_letters_Symbol[i], Separate_letters_Symbol[i]);
}
Yes, in this part of the code, I think I did that by capturing the last letter of the word in the chat through its last output in the previous code, then I returned the last letter of a connected letter to a separate letter (contrary to what I did in the previous code)
Код:
new said_utf8[192];//First Letters
getWord_UTF8(said_utf8, charsmax(said_utf8), said_to_utf8)
new result[192];
formatex(result, charsmax(result), "%s%s", last_leter, said_utf8);
Here I captured the word except for the last letter and then output them in one interface in the results (
i.e. the last letter that was previously replaced with the word without the last letter)
The results are somewhat unsatisfactory because there is a space between the last letter and the word.
Result what i get : م(space)سلا "As attached in the picture"
Result what i need : سلام "like as
defult output (UP)result but form of last letter should be (م) not (مـ) "
I am wondering if there is another way to analyze the letters inside each word and ignore the replacement of the last letter, i.e. leave it as it is (i.e. replace the letters of words without replacing the last letter of it)
Lev писал(а):
After you will get the output byte sequence that will looks good, you can start to deal with the input byte sequence to convert it in the correct form.
Could you give me a simple example to make it clearer?