Half-Life и Adrenaline Gamer форум http://econ.aghl.ru/forum/ |
|
UTF-8 in Chat check letters http://econ.aghl.ru/forum/viewtopic.php?f=12&t=3313 |
Страница 2 из 3 |
Автор: | abdobiskra [ 14 июн 2023, 19:52 ] | ||
Заголовок сообщения: | Re: UTF-8 in Chat check letters | ||
Leo I apologize I didn't explain this part as well In order for the sentence to be printed correctly in the game, it is written from left to right in connected letters and takes this form : "ﻣﻛﻟﺎﺣ ﻓﻳﻛ ﻣﻛﻳﻟﻋ ﻣﺎﻟﺳ" I copied it from inside the game from right to left, as in the previous result. I don't understand why it shifts again from left to right if I copied it outside the game You can try the sentence in the game to see the results in the chat will become right to left. The same thing often happens in programs that do not support the Arabic language, and there are some sites that offer a correction for this problem, such as: arabic-keyboard Here the comparison result is completely different or the program does not recognize the rtl2.txt file. Вложение: Вложение:
|
Автор: | Lev [ 15 июн 2023, 23:54 ] |
Заголовок сообщения: | Re: UTF-8 in Chat check letters |
These files are encoded differently. One use 2 byte per letter second one use 3 bytes per letter. Not sure why, but UTF-8 supports this. Probably these are just different letters with higher indexes. Answer this question: can you output text in a correct form in the HL sceen or not? You can try to insert text from rtl2.txt file right into the plugin file. If no, probably it is not possible. And, BTW, use Steam version (or new non-steam) UTF support threre could be better. |
Автор: | abdobiskra [ 16 июн 2023, 12:31 ] |
Заголовок сообщения: | Re: UTF-8 in Chat check letters |
Lev писал(а): These files are encoded differently. One use 2 byte per letter second one use 3 bytes per letter. Not sure why, but UTF-8 supports this. Probably these are just different letters with higher indexes. It is also perfect, meaning that they are not written in the same wayThe text of rtl1.txt was written directly into notepad and saved, while the text of rtl2.txt was copied from within the game, that is, after it was modified for this reason. The rtl2txt text is the one that gives correct results inside the game screen, which are the results of the plugin. After copying it here on the site, the conjoined letters become from left to right, but when printed on the game screen, the conjoined letters become from right to left and are understandable. Lev писал(а): Answer this question: can you output text in a correct form in the HL sceen or not? You can try to insert text from rtl2.txt file right into the plugin file. Yes, I can. If I want to print the text inside the screen as it is, I have to save the plugin source with Encode in UTF-8 -BOM settings using Notepad++ because the AMXX-Studio program does not support these settings, I opened the file again using it, and the text appears in the ANSI setting, but the results appear in the game screen fineIf no, probably it is not possible. And, BTW, use Steam version (or new non-steam) UTF support threre could be better. This is with regard to printing specific text only. As for chatting, this requires only modification to letters and words Yes, i'm already using game steam. I just wanted to add a function in the plugin that enables me to ignore the last character of its substitution but it's hard to select after converting letters and words from right to left. I think it's possible but I don't have a way. |
Автор: | Lev [ 16 июн 2023, 12:50 ] |
Заголовок сообщения: | Re: UTF-8 in Chat check letters |
It is still hard for me to fully understand. I have to get: text and bytes of the text that is correctly shown on the screen as you want it. And text and bytes that you get from the chat input (probably after RTL convertion you have olread wrote). Then we can figure out how to adjust the text for correct output. |
Автор: | abdobiskra [ 16 июн 2023, 14:21 ] |
Заголовок сообщения: | Re: UTF-8 in Chat check letters |
Well, these are two similar texts rtl1.txt It is the text whose words contain the last letters correctly are what i want Вложение: rtl2.txt The ones whose words don't have valid last letters are what I get in the plugin Вложение: You can print it inside the screen. You will find the difference in the last letter of each word when counting the letters from right to left inside the game screen "The problem is not in the text the problem is that the function replace_all in code it replaces all letters of the word only, and I want to specify that it replaces all letters of the word except for its last letter, because it is already spelled correctly This process is just a correction of the shape of the letter according to its location in the word" P.S: For me, when I read what is inside the files, it gives the writing upside down from left to right, but it must be really like this in order to get a good result inside the screen (as if it were a trick or a hack or something like that) Because when I want to write it in programs that support the Arabic language, for example, or websites, or in this forum or others, it is much easier and more correct than that |
Автор: | Lev [ 16 июн 2023, 17:28 ] | ||||
Заголовок сообщения: | Re: UTF-8 in Chat check letters | ||||
I replaced extra letter in one word from the file to align bytes. Here what I got Вложение: rtl1.png [ 2.16 КБ | Просмотров: 919 ] Вложение: rtl2.png [ 1.94 КБ | Просмотров: 919 ] Вложение: You can notice that last letter in bad file is using code A3, and the one you wish use A2 or A1 - probably these are a bit differently connected letters. But I used one of them - A1 for replacement. I copied rtl2.txt into rtl3.txt and replaced last letter in each word: Вложение: rtl3.png [ 2.12 КБ | Просмотров: 919 ] Вложение: Вложение: But there are still some differences from rtl1.txt (the one you wish to output) Вложение: These are other highlighted letters in first byte-to-byte comparision. So I can suppose you can replace 0xEFBBA3 bytes with 0xEFBBA1 and 0xEFBB93 with 0xEFBB92. There can be other replacements (for example in first comparision), you should search yourself for them. I dunno why typing ingame or in some text editor gives different letters - you can search for that yourself.
|
Автор: | abdobiskra [ 16 июн 2023, 19:22 ] |
Заголовок сообщения: | Re: UTF-8 in Chat check letters |
Yeah, I got the result by replacing the bytes! This is the method I used, but in some words it replaces the letters from the middle of the word Do I need to specify the position of the letter in the word (beginning - middle - end)? What came to my mind is to determine the position of the character in the word and then replace the appropriate bytes after checking its position. Can it work? Or is there some way --Will this information help me check and replace bytes? https://en.wikipedia.org/wiki/Arabic_script_in_Unicode |
Автор: | Lev [ 16 июн 2023, 20:37 ] |
Заголовок сообщения: | Re: UTF-8 in Chat check letters |
To check word border you can search for 0x20 before, for ex. 0x20EFBBA3 (excluding string start position). There can be other whitespace symbols, but probably you can rely on just "space". abdobiskra писал(а): --Will this information help me check and replace bytes? Yes. For example 0xFEE3 (its \xEF\xBB\xA3) is used at the "Initial (Beginning)", 0xFEE2 (\xEF\xBB\xA2) at "Final (End)" and 0xFEE1 (\xEF\xBB\xA1) when "Isolated".https://en.wikipedia.org/wiki/Arabic_script_in_Unicode So I think you should replace to A2 at the word end. With this info it is more clear why A3 was used - because that letter was at the beginning of the word before you reversed it. To answer before you ask: https://www.compart.com/en/unicode/U+FE91 UTF-8 Encoding: 0xEF 0xBA 0x91 UTF-16 Encoding: 0xFE91 |
Автор: | abdobiskra [ 20 июн 2023, 00:14 ] |
Заголовок сообщения: | Re: UTF-8 in Chat check letters |
Very good, I did not succeed in determining the position of the letter if it was in the middle or the beginning of the word, but the end of the word, I think I already got it. |
Автор: | abdobiskra [ 15 июл 2023, 23:47 ] |
Заголовок сообщения: | Re: UTF-8 in Chat check letters |
When writing a large line, the words at the end disappear. Can this be fixed? |
Страница 2 из 3 | Часовой пояс: UTC + 5 часов [ Летнее время ] |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |