Skip to content

Instantly share code, notes, and snippets.

@kawasima
Last active December 16, 2015 01:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawasima/11162616 to your computer and use it in GitHub Desktop.
Save kawasima/11162616 to your computer and use it in GitHub Desktop.
(defn to-hex-str [bs]
(let [sb (StringBuilder. 8)]
(doseq [b bs]
(.append sb (Integer/toHexString (bit-and (bit-shift-right b 4) 0xF)))
(.append sb (Integer/toHexString (bit-and b 0xF))))
(.toString sb)))
(doseq [i (range 32 65536)]
(let [ch (String. (into-array Integer/TYPE [i]) 0 1)
ch-ms932 (vec (.getBytes ch "ms932"))
ch-cp943c (vec (.getBytes ch "cp943c"))]
(if (not= ch-ms932 ch-cp943c)
(println ch (format "%x" i) (to-hex-str ch-ms932) (to-hex-str ch-cp943c)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment