[BUG]Some problems with Unicode
#1

I format a string like this(same as using "format") using colour embedding:
Код:
new string[128] = "";
strcat(string," 輸入{FF0000}/racestart{00BF8A}可以舉行{8000FF}");
strcat(string,RaceName[CurrentCP[playerid] - CP_BLRACE]);
strcat(string,"{00BF8A}.");
SendClientMessage(playerid, COLOR_BLUEISHGREEN, string);
But the result is:


Also, some unicode characters cannot be displayed(while 0.3b can),showing something like formating strings with unicode characters without any ascii characters before it.Some unicode characters are also identified as invalid character constant in the compiler.
Reply
#2

Does it work fine if the colours are not embedded?
Reply
#3

Yes.
Problems only comes with Unicode characters.Nothing wrong with ascii characters only.

EDIT:
While putting the colours like this:
Код:
new string[128] = "";
strcat(string," 輸{FF0000}入/racesta{00BF8A}rt可{FF0000}以舉行");
strcat(string,RaceName[CurrentCP[playerid] - CP_BLRACE]);
strcat(string,"{00BF8A}.");
SendClientMessage(playerid, COLOR_BLUEISHGREEN, string);
will works fine,the string "/racestart" will be completely red.("Offset"?)

Some Unicode characters cannot display even without colour embedding.
Reply
#4

Is it fixed if you put a space between colour codes?

Код:
strcat(string," 輸入 {FF0000} /racestart {00BF8A} 可以舉行 {8000FF}");
Reply
#5

No.It still have some offset.
Reply
#6

Ok. There is obviously a character collision using the { symbol. The colour embedding sequence might have to be changed. Thanks for reporting the problem.
Reply
#7

You're welcome.
Look forward to this

EDIT:
I now know why some of the Unicode characters cannot be displayed.
In hex coding,some characters will be B27B or B27D,which 7B = 123,which is equal to "{" while 7D = 125 = "}"....
Reply
#8

Quote:
Originally Posted by Kalcor
Посмотреть сообщение
Ok. There is obviously a character collision using the { symbol. The colour embedding sequence might have to be changed. Thanks for reporting the problem.
Actually, was curious as to why you chose to add the colour embedding in string rather than as a variable argument (like format). If worse comes to worse, I was thinking something like the following would do;

SendClientMessage(playerid, color, msg[], ...);

Shouldn't having it like this would get rid of the need to process the strings? The scripters could just expand the function to something like;

SendClientMessage(playerid, 0xFFFFFFFF, "White", 0xFF000000, "Red");

That should still be completely compatible with the older scripts or a variation on the idea should be.
Reply
#9

Quote:
Originally Posted by Simon
Посмотреть сообщение
SendClientMessage(playerid, 0xFFFFFFFF, "White", 0xFF000000, "Red");

That should still be completely compatible with the older scripts or a variation on the idea should be.
And incompatible with any sane logic where you dynamicly generate client messages, i would love to see you do this in a "list box" dialog for example.
Reply
#10

Fair point on the list dialogs. My mind was stuck in client messages with only a few pre-defined colours for presentation purposes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)