[Lib] utf-8.lua with unicode conversions

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
markgo
Party member
Posts: 190
Joined: Sat Jan 05, 2013 12:21 am
Location: USA

[Lib] utf-8.lua with unicode conversions

Post by markgo »

This is an edit of Kyle Smith's utf8 library with functions for converting UTF8 strings to unicodes and vice-versa. It's useful for converting the unicode passed to keypressed and keyreleased. Enjoy!

https://gist.github.com/markandgo/5776124

A simple test:

Code: Select all

require 'utf8'
 
for unicode = 1,0xD7FF do
assert(string.utf8unicode( string.utf8char(unicode) ) == unicode,unicode)
end
 
for unicode = 0xE000,0x10FFFF do
assert(string.utf8unicode( string.utf8char(unicode) ) == unicode,unicode)
end
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests