Created
August 18, 2022 03:07
-
-
Save curioustorvald/b68e60ce1dadcab9bc892c983f901880 to your computer and use it in GitHub Desktop.
Oesolise — 최현배식 푸러쓰기를 유니코드로 어떻게든 풀어 쓰기
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function oesolise(string) { | |
const choseong = ['ᴊ','ᴊᴊ','ʟ','c','cc','ƨ','ᴅ','ᵾ','ᵾᵾ','ʌ','ʌʌ','','ʌ̅','ʌ̅ʌ̅','ƛ','ᴊ̵','ᴇ','z̵','ô'] | |
const jungseong = ['h','hı','k','kı','q','qı','εլ','εլı','⊥','⊥̌h','⊥̌hı','⊥̌ı','⫫','ᴛ','ᴛq','ᴛqı','ᴛı','⫪','ᴜ','ᴜı','I'] | |
const jongseong = ['','ᴊ','ᴊᴊ','ᴊʌ','ʟ','ʟʌ̅','ʟô','c','ƨ','ƨᴊ','ƨᴅ','ƨᵾ','ƨʌ','ƨᴇ','ƨz̵','ƨô','ᴅ','ᵾ','ᵾʌ','ʌ','ʌʌ','o','ʌ̅','ƛ','ᴊ̵','ᴇ','z̵','ô'] | |
let outbuf = '' | |
const chars = [...string] | |
chars.map(it => it.codePointAt(0)).forEach(cp => { | |
if (0xAC00 <= cp && cp <= 0xD7A3) { | |
let base = cp - 0xAC00 | |
let indexInitial = (base / 588)|0 | |
let indexPeak = ((base / 28)|0) % 21 | |
let indexFinal = base % 28 | |
outbuf += choseong[indexInitial] | |
outbuf += jungseong[indexPeak] | |
outbuf += jongseong[indexFinal] | |
} | |
else { | |
outbuf += String.fromCodePoint(cp) | |
} | |
}) | |
return outbuf | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment