[stock]utf8 safe string cutter
i made this function because GetClientName doesnt cuts string in utf8 safe way
Code:
|
Re: [stock]utf8 safe string cutter
I'm not sure exactly what all this does, but...
Code:
if(UTF8MULTIBYTECHAR & buffer[i] == '\0'){Having said that, if you're dealing with GetClientName, the String you put it in should be MAX_NAME_LENGTH in size. |
Re: [stock]utf8 safe string cutter
ah, i forgot about that function, however, because of other bit operations, i still need that const.
so i will just leave that. and, even u give string buffer with enough size that corresponds MAX_NAME_LENGTH, because game`s client name string itself is cutted in non utf8 safe way, it can return strings that r having a sliced multibyte character on end of string. |
Re: [stock]utf8 safe string cutter
eh...and that IsCharMB looks like not so good to handle bytes in String[].
p.s. or is it ok? well, i have no idea. but i will leave that code because its not bad. p.s. well, the function seems like ok. |
Re: [stock]utf8 safe string cutter
When I am trying to rename player with utf8 character(s), it prints corrupted result (symbols). Can your snippet fix that?
|
Re: [stock]utf8 safe string cutter
Quote:
|
Re: [stock]utf8 safe string cutter
I used default playercommands plugin. Ie sm_rename #userid|name, which is containing UTF8 symbols (see russian alphabed)
It showed ********* instead of correct symbol |
Re: [stock]utf8 safe string cutter
Quote:
PHP Code:
|
| All times are GMT -4. The time now is 13:42. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.