Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -1,6 +1,6 @@
As the world gets smaller each day, internationalization becomes more and more important.   For handling multiple languages, [[Unicode]] is your best friend.
It is a very capable and [https://www.youtube.com/watch?v=MijmeoH9LT4 remarquable] tool, but also quite complex compared to older single- and double-byte character encodings.
It is a very capable and [https://www.youtube.com/watch?v=MijmeoH9LT4 remarkable] tool, but also quite complex compared to older single- and double-byte character encodings.
How well prepared is your programming language for Unicode?

View file

@ -0,0 +1,14 @@
s$ = "你好 😀"
print len s$
for c$ in strchars s$
print c$ & " " & strcode c$
.
print strpos s$ "好"
print strchar 128512
print s$
flag$ = "🇮🇹"
print flag$
print len flag$
for c$ in strchars flag$
print c$ & " " & strcode c$
.

View file

@ -0,0 +1,26 @@
require "uchar"
require "gchar"
local fmt = require("fmt")
local w = "voilà"
local u = uchar.of(w)
for i = 1, u:len() do
io.write($"{u:get(i)} ") -- prints the 5 Unicode 'characters'
end
print($"\nThe length of {w} is {u:len()}")
print("\nIts code-points are:")
fmt.lprint(u:tocodes(), " ", "") -- prints the code-points as numbers
print("\n\nIts bytes are: ")
fmt.lprint(u:tobytes(), " ", "") -- prints the bytes as numbers
local zwe = "👨‍👩‍👧"
local g = gchar.of(zwe)
local codepoints = g:tocodes()
local bytes = g:tobytes()
print($"\n\n{zwe} has:")
fmt.print(" %d bytes: %s", #bytes, fmt.swrite(bytes, " ", ""))
fmt.print(" %d code-points: %s", #codepoints, fmt.swrite(codepoints, " ", ""))
fmt.print(" %d grapheme", g:len())