hangul in unicode
| ID | d9eed7ff-8596-47d8-a8b3-9f249594eb30 |
|---|
| DEERTOPIAVISIBILITY | public |
|---|
hangul + unicode
(straight-use-package 'org-nix-shell)
(org-nix-shell-mode 1)
(org-babel-do-load-languages 'org-babel-load-languages
'((clojure . t)))
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
packages = [ pkgs.clojure ];
}
(require '[clojure.string :as str])
(import (java.text Normalizer Normalizer$Form))
;; The string "한글" encoded with the HANGUL SYLLABLES block.
(def hangul-syllables-example
(str \ud55c \uae00))
;; The same string "한글" encoded with the HANGUL JAMO block.
(def hangul-jamo-example
(str \u1112 \u1161 \u11ab \u1100 \u1173 \u11af))
;; Both strings appear the same.
(println "hangul syllables:" hangul-syllables-example)
(println " hangul jamo:" hangul-jamo-example)
unimplemented! (fixed-width)
{:type "fixed-width",
:affiliated {:results ""},
:value "class java.lang.UnsupportedOperationException",
:position
{:start {:line 51, :column 1, :offset 1299},
:end {:line 51, :column 48, :offset 1346}}}
(defn string->bytes
"Return the UTF-8(?) encoding of a string."
[s]
(-> s .getBytes seq))
(println "hangul-syllables-example byte count:"
(-> hangul-syllables-example string->bytes count))
(println " hangul-jamo-example byte count:"
(-> hangul-jamo-example string->bytes count))
unimplemented! (fixed-width)
{:type "fixed-width",
:affiliated {:results ""},
:value
"hangul-syllables-example byte count: 6\n hangul-jamo-example byte count: 18",
:position
{:start {:line 66, :column 1, :offset 1747},
:end {:line 67, :column 42, :offset 1829}}}
(= hangul-syllables-example hangul-jamo-example)
unimplemented! (fixed-width)
{:type "fixed-width",
:affiliated {:results ""},
:value "false",
:position
{:start {:line 74, :column 1, :offset 1941},
:end {:line 74, :column 8, :offset 1948}}}
(defn normalise [s]
(Normalizer/normalize s Normalizer$Form/NFC))
(= hangul-syllables-example (normalise hangul-jamo-example))
unimplemented! (fixed-width)
{:type "fixed-width",
:affiliated {:results ""},
:value "true",
:position
{:start {:line 84, :column 1, :offset 2145},
:end {:line 84, :column 7, :offset 2151}}}
(seq hangul-syllables-example)
unimplemented! (fixed-width)
{:type "fixed-width",
:affiliated {:results ""},
:value "(\\한 \\글)",
:position
{:start {:line 91, :column 1, :offset 2247},
:end {:line 91, :column 10, :offset 2256}}}
(seq hangul-jamo-example)
unimplemented! (fixed-width)
{:type "fixed-width",
:affiliated {:results ""},
:value "(\\ᄒ \\ᅡ \\ᆫ \\ᄀ \\ᅳ \\ᆯ)",
:position
{:start {:line 98, :column 1, :offset 2347},
:end {:line 98, :column 22, :offset 2368}}}
(str/ends-with? hangul-jamo-example "ᆯ")
unimplemented! (fixed-width)
{:type "fixed-width",
:affiliated {:results ""},
:value "true",
:position
{:start {:line 105, :column 1, :offset 2474},
:end {:line 105, :column 7, :offset 2480}}}
(str/ends-with? hangul-syllables-example "ᆯ")
unimplemented! (fixed-width)
{:type "fixed-width",
:affiliated {:results ""},
:value "false",
:position
{:start {:line 112, :column 1, :offset 2591},
:end {:line 112, :column 8, :offset 2598}}}