English 2Gen's "Simple UTF-8" icon

6 comments
20.06.21 08:30:57 pm
like 4 like it!
2 kb, 306 Downloads
2Gen
User
Offline Off
I found super tiny UTF-8 hex decode function in the internet invented by unknown person and modified it a bit to fit for cs2d. Just because another uft-8 library by Engineer is overly complicated and have bugs.


WARNING:
1) For chinese, japanese, korean, thai and some other languages which use non-latin characters or hieroglyphs in their alphabets you need to find and download special fonts, that have Unicode block (section) for that language, for example "Arial Unicode MS.ttf" will support all these listed above languages, rename downloaded font to "liberationsans.ttf" (defaulf cs2d font in 1.0.1.2 version) and copy with replace to cs2d/gfx/fonts.
2) for colored texts use © not \169
3) function works good in cs2d 1.0.1.2, but not guaranteed to work in future versions

BUGS:
- you can't use ; (semicolon), but it's vanilla cs2d bug/limitation


INSTALLATION:
drop simpleutf8.lua to cs2d/sys/lua folder and dofile it in server.lua     
     dofile("sys/lua/simpleutf8.lua")


USAGE:     
Spoiler >

parse replacement method:     
Spoiler >



fix for ui-framework:
Spoiler >




P.S. I know cs2d is dead but I don't care, we still can make some funny things in it

Good Luck!
image
ok This file has been reviewed and approved by Seekay (15.04.22 04:20:17 am)

Comments

6 comments
Goto Page
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in
30.08.21 04:58:39 pm
Up
mrc
User
Offline Off
make it compatible with menus too
edited 2×, last 31.08.21 06:15:45 am
24.06.21 08:55:08 am
like I like it!
Up
Marcell
Super User
Offline Off
Good job!
23.06.21 12:19:34 pm
Up
2Gen
User
Offline Off
@user Hajt: Unfortunately 'cs2d=>lua' text from say hook can be received only for english language. For example, I tried to get messages data from russian and lua sees and saves " !"#$%&'()*+,-./" instead "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ". It seems I suggested to devs 3+ years ago to add UTF-8 support for 'from-game to lua texts' but as you can see there is no any.

@user _Lima_: @user StirlizZ-Fapicon:
Thank you. I'm also nicely surprised that you guys are still here
22.06.21 02:10:03 pm
like I like it!
Up
Hajt
User
Offline Off
I didn't check yet but i wonder if I can take utf8 msg from say hook then display it with parse msg, im not sure if you understand what i mean
edited 1×, last 23.06.21 12:36:37 am
20.06.21 10:50:45 pm
like I like it!
Up
StirlizZ-Fapicon
Super User
Offline Off
Glad to see oldschool players are coming back
20.06.21 09:18:25 pm
like I like it!
Up
_Lima_
User
Offline Off
2Gen is back, awesome!
To the start Previous 1 Next To the start