File: qa-utf8-special

package info (click to toggle)
newlisp 10.7.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 6,248 kB
  • sloc: ansic: 33,280; lisp: 4,181; sh: 609; makefile: 215
file content (31 lines) | stat: -rwxr-xr-x 1,177 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env newlisp

; regex compile of UTF-8 patterns

(if (catch (regex-comp "ほげほげ" 0x800) 'result)
    (println "UTF-8 compile sucessfull")
    (println "problem in UTF-8 compile"))

; UTF-8 - transforming from and to nmbers, upper-case'ing and lower-case'ing

; should show Chinese characters if editor or terminal is UTF-8 capable
(println "characters entered by keyboard:")

(println (set 'utf8str "我能吞下玻璃而不伤身体。"))

(println "should look the same as made from unicode numbers:")

(set 'utf8chars '(25105 33021 21534 19979 29627 29827 32780 19981 20260 36523 20307 12290))
(println (set 'utf8str (join (map char utf8chars))))

(print "and be transformd back to the same numbers: ")
(println (= (map char (explode utf8str)) utf8chars))

(println "checking upper-case'ing on russian letters")
(println "абвгдеёжзийклмнопрстуфхцчшщъыьэюя")
(println (upper-case "абвгдеёжзийклмнопрстуфхцчшщъыьэюя") " should be uppercase of previous")
(println (lower-case (upper-case "абвгдеёжзийклмнопрстуфхцчшщъыьэюя")) " and back to lowercase")

(exit)