GNOME characters(그놈 문자표)의 선택된 한글 음절의 자모분해 버그 수정 (with GNU libunistring)

(English follows Korean)

안녕하세요, 저는 2017년 5월부터 GNOME Foundation Member가 된 성대현입니다.

Hello, I’m DaeHyun Sung(성대현,成大鉉), I am the GNOME Foundation Member since May 2017.

저는 GNOME characters(그놈 문자표)의 한글 음절의 정준분해의 버그를 수정하여 제출하였고, 제출한 제안은 소스코드와 CHANGELOG에 반영되었습니다.

I submitted to fix the Korean alphabet, Hangul Canonical Decomposition bugs on GNU libunistring & GNOME characters. also My suggestion accepted by both GNU libunistring and GNOME characters committers.

GNU libunistring: https://www.gnu.org/software/libunistring/

GNOME Characters: https://wiki.gnome.org/Design/Apps/CharacterMap

3달전 GNOME characters의 한국어 한글 음절의 자모 분리 버그 확인

3-month ago(September. 2017), I checked the Korean Alphabet(Hangul) Syllable’s canonical decomposition bug on GNOME characters

2017년 9월 2일, GNOME Korea(그놈 한국)에서는 GNOME 20주년 파티 및 GNOME 한국의 한국어 번역 해커톤이 열렸습니다.

GNOME Korea made a meetup, GNOME 20th anniversary and GNOME Korea’s Korean Translation Hackathon in Seoul, Korea in Sept. 2nd.2017.

First, GNOME Korea’s GNOME 20th anniversary party and Korean Translation Hackathon. Last, GNOME characters on screen.

이때 저는 GNOME characters의 번역을 보다, GNOME characters의 한국어 한글 음절의 자모 분리 버그를 확인하였습니다.

I found the Korean alphabet, Hangul’s Syllables canonical decomposition bug on GNOME characters.

Selected Hangul Syllable “가” on GNOME characters
Selected Hangul Syllable “가" Left. only shown “ㄱ" Bug , Right: Expected, shown ‘ㄱ’ and ‘ㅏ’

저는 GNOME Asia가 열린 중국 중경(中國 重慶/中国 重庆/Chongqing, China🇨🇳)에 갔다온후 GNU libunistring의 한글 음절(Hangul Syllable)에 대한 정준분해(Canonical Decomposition) 버그(bug)를 수정하였습니다.

I fixed the Korean Hangul Syllables Canonical decomposition on GNU libunistring in Korea, after I attended to GNOME Asia 2017 Chongqing, China

추가작업으로 GNOME-character의 선택된 한글 음절(Hangul Syllable)에 대한 정준 분해(Canonical Decomposition)에 대한 노출작업(초성은 이미 프로그램상 노출되었으나, 중성, 종성에 대한 노출작업)을 진행하였습니다.

Also, I fixed the Korean Hangul Syllables Canonical decomposition on GNOME characters.

  1. GNU libunistring
The Unicode® Standard Version 10.0 — Core Specification, Chapter 3. Conformance http://www.unicode.org/versions/Unicode10.0.0/ch03.pdf

유니코드 컨소시엄(Unicode Consortium)은 한국어의 문자(음절)에 대해 정준분해를 정의하였고, 코드 예제를문서로 작성하였습니다.

Unicode Consortium defined the Korean Hangul characters(Syllables) canonical decomposition and also wrote the code examples on Unicode Standard Core Specification.

아래는 GNU libunistring의 한글의 정준분해에 대한 코드 예제입니다.

Below is Code Example about Korean Hangul Canonical Decomposition on GNU libunistring

libunistring/lib/uninorm/canonical-decomposition.cif (uc >= 0xAC00 && uc < 0xD7A4) 
{
/* Hangul syllable. See Unicode standard, chapter 3, section “Hangul Syllable Decomposition”, See also the clarification at <http://www.unicode.org/versions/Unicode5.1.0/>, section “Clarification of Hangul Jamo Handling”. */
unsigned int t; uc -= 0xAC00;
t = uc % 28;
if (t == 0)
{
unsigned int v, l;
uc = uc / 28;
v = uc % 21;
l = uc / 21;
decomposition[0] = 0x1100 + l;
decomposition[1] = 0x1161 + v;
return 2;
}
else
{
#if 1 /* Return the pairwise decomposition, not the full decomposition. */
decomposition[0] = 0xAC00 + uc — t; /* = 0xAC00 + (l * 21 + v) * 28; */
decomposition[1] = 0x11A7 + t;
return 2;
#else
unsigned int v, l;
uc = uc / 28; v = uc % 21;
l = uc / 21;
decomposition[0] = 0x1100 + l;
decomposition[1] = 0x1161 + v;
decomposition[2] = 0x11A7 + t;
return 3;
#endif
}
}

저는 “#if 1”에 대한 구문이 왜 필요한지에 대한 문제제기를 하였습니다.

이후, 저는 Unicode Consortium에 작성된 문서를 근거로 전체 정준분해에 대한 diff파일을 만든 후에 GNU libunistring개발자에게 메일로 수정내역을 전달하였습니다.

That code(the source code part of #if 1) is not Korean hangul fully decomposition.

I found Korean Syllables Canonical Decomposition bug Not fully decompose Hangul Syllables.

Expected: U+D4DB → <U+1111, U+1171, U+11B6> = Full canonical composition result. correct!

Result: U+D4DB → <U+D4CC,U+11B6> = only intermediate step. incorrect

그리고 GNU libunistring committer에게 버그 리포팅을 메일로 제출하였습니다.

Also, I sent the email at GNU libunistring committer about the Korean Syllables Canonical Decomposition bug.

2017년 11월 18일.

November 18th, 2017.

GNU libunistring committer “Bruno Haible”씨가 저의 Email을 읽어보고는, 저의 제안에 대하여, 구현물에 대한 명확한 설명을 추가를 하였습니다.

uc_canonical_decomposition() is not capable of decomposing Hangul syllables. Instead of the function, this patch uses u32_normalize() with UNINORM_NFD, as suggested by Bruno Haible in: https://lists.gnu.org/archive/html/bug-libunistring/2017-11/msg00002.html

그리고 CHANGELOG에 저의 제안이 추가되었습니다.

Then, My suggestion added to GNU libunistring CHANGELOG.

Clarify the effect of uc_canonical_decomposition.

Prompted by a report by DaeHyun Sung < ****** @ ****.*** >.
* doc/uninorm.texi (Decomposition of characters): Clarify.
* doc/libunistring.texi: Bump copyright year.

저는 GNU libunistring ‘CHANGELOG’에 저의 제안, 제 이름과 이메일이 들어간걸 영광으로 여깁니다.

2. GNOME characters

수정 작업 전 화면(Before fixed the bug)

  1. 초성+중성 2가지의 조합으로 존재하는 음절의 경우

예[Example,例]: 가 (ga)

Korean Syllable ‘가'’s

2. 초성+중성+종성 3가지의 조합으로 존재하는 음절의 경우

예[Example,例]: 쀍 (bbwelg)

Selected Hangul Syllable ‘쀍' canonical decomposition bug. Expected result is ‘ㅃ’ ‘ㅞ’

수정 작업(Work to fix the bug)

한국어의 음절의 정준분해 기능 버그를 수정중. I’m working about fixing the Korean Canonical Decomposition bug.
Now, I fixed Korean Canonical Decomposition Bug on GNOME characters
Now, I fixed Korean Canonical Decomposition Bug on GNOME characters
Now, I fixed Korean Canonical Decomposition Bug on GNOME characters

수정 작업후 결과 (After fixed the bug)

  1. 초성+중성 2가지의 조합으로 존재하는 음절의 경우[Korean Hangul Syllables about combined two elements such as CHOSEONG(초성,初聲,Initia consonant) + JUNGSEONG(중성,中聲,vowel)]

예[Example,例]: 가 (ga)

Decomposition of hangul syllable 
Unicode codepoint: U+AC00
Hangul(한글) ‘가’
jamo(자모/字母): ㄱ plus ㅏ
choseong(초성/初聲): ㄱ (codepoint: U+1100)
jungseong(중성/中聲): ㅏ(codepoint: U+1161)

Selected Hangul syllable ‘가’(U+AC00)
Present
Canonical decomposition:
ㄱ U+1100 HANGUL CHOSEONG KIYEOK
ㅏ U+1161 HANGUL JUNGSEONG A

Expected result
Canonical decomposition:
ㄱ U+1100 HANGUL CHOSEONG KIYEOK
ㅏ U+1161 HANGUL JUNGSEONG A

Hangul Choseong:ᄀ
Hangul Jungseong:ᅡ

2. 초성+중성+종성 3가지의 조합으로 존재하는 음절의 경우[Korean Hangul Syllables about combined three elements such as CHOSEONG(초성,初聲,Initial consonant) + JUNGSEONG(중성,中聲,vowel) + JONGSEONG(종성,終聲, Final consonant)]

예[Example,例]: 쀍 (bbwelg)

Selected Hangul Syllable ‘쀍’ canonical decomposition’s expected result.
Example] 쀍Decomposition of hangul syllable
Unicode code point: U+C00D
Hangul(한글) ‘쀍’
jamo(자모/字母): ‘’ plus ‘’ plus ‘
choseong(초성/初聲):ㄱ (codepoint: U+1108)
jungseong(중성/中聲):ㅏ(codepoint: U+1170)
jongseong(종성/終聲):ᆨ (codepoint: U+11B0)


Selected Hangul syllable ‘쀍’(U+C00D)
Present
Canonical decomposition:
‘쀄 U+C004 HANGUL SYLLABLE BBWE' It's intermediate step.
' U+11B0 HANGUL JONGSEONG KIYEOK'

Expected Result
Canonical decomposition(Fully):
ᄈ U+1108 HANGUL CHOSEONG SSANGPIEUP
ᅰ U+1170 HANGUL JUNGSEONG WE
ᆰ U+11B0 HANGUL JONGSEONG RIEUL-KIYEOK

Hangul Choseong:
Hangul Jungseong:
Hangul Jongseong:
Example] 각Decomposition of hangul syllable
Unicode code point: U+AC01
Hangul(한글) ‘각’
jamo(자모/字母): ‘ᄀ’ plus ‘ᅡ’ plus ‘ᆨ’
choseong(초성/初聲):ㄱ (codepoint: U+1100)
jungseong(중성/中聲):ㅏ(codepoint: U+1161)
jongseong(종성/終聲):ᆨ (codepoint: U+11A8)


Selected Hangul syllable ‘각’(U+AC01)
Present
Canonical decomposition:
‘가 U+AC00 HANGUL SYLLABLE GA' It's intermediate step.
'ᆨ U+11A8 HANGUL JONGSEONG KIYEOK'

Expected Result
Canonical decomposition(Fully):
ㄱ U+1100 HANGUL CHOSEONG KIYEOK
ㅏ U+1161 HANGUL JUNGSEONG A
ᆨ U+11A8 HANGUL JONGSEONG KIYEOK

Hangul Choseong:ᄀ
Hangul Jungseong:ᅡ
Hangul Jongseong:ᆨ

저는 GNOME characters에 버그 리포팅을 다음의 링크로 제출하였습니다.

I wrote Korean Syllables Canonical Decomposition bug on GNOME characters and submitted it.

이후, GNOME characters의 커미터이신 Ueno Daiki씨는 저의 제안을 받아들였습니다. 커밋로그에 저의 제안을 추가하고 GNU libunistring의 변경사항을 GNOME characters에 통합하였습니다.

libgc: Perform full canonical decomposition for Hangul syllables
Previously, the code finding related characters only took into account
of composed characters built from a base character and combining
characters (such as Latin, Hiragana, and Katakana). However, Hangul
syllables are composed of two or three Hangul jamo characters, all of
which should be considered as a base character. This patch handles
that case properly.
For the implementation, uc_canonical_decomposition() is not capable of
decomposing Hangul syllables. Instead of the function, this patch
uses u32_normalize() with UNINORM_NFD, as suggested by Bruno Haible in:
https://lists.gnu.org/archive/html/bug-libunistring/2017-11/msg00002.html
https://bugzilla.gnome.org/show_bug.cgi?id=790391

이제, GNOME characters(그놈 문자표)는 선택된 한글 음절에 대한 정준분해 오류를 수정하였습니다. 또한 GNOME characters(그놈 문자표)에 GNU libunistring의 최신버전 적용이 되었습니다.

Now, GNOME characters fixed Korean Hangul Syllables canonical decomposition bug. Also GNOME characters committer applied new GNOME libunistinrg version on GNOME characters.

요약(Summary)

저는 GNOME characters와 GNU libunistring은 한글 음절의 정준분해에 대한 동일한 문제를 가진 것을 확인하였습니다.

I found Both GNOME characters and GNU libunistring has same problem about Korean Syllables Canonical Decomposition.

저는 한글 음절의 정준분해에 대한 오류 수정 제안을 GNU libunistring 및 GNOME characters(그놈 문자표) 커미터에게 제출하였고, 저의 제안은 GNU libunistring과 GNOME characters(그놈 문자표) 커미터가 받아들였습니다.

Now, I submitted the Korean Hangul Syllables Canonical Decomposition, And My suggestion accepted by both GNU libunistring and GNOME characters committers.

GNU libunistring 및 GNOME characters(그놈 문자표) 커미터분께 고마움을 느낍니다!

Thanks a lot, to GNU libunistring and GNOME characters committers!

후신. 저는 몇몇 라이브러리에서 아시아 언어에 대한 버그가 있다고 생각합니다 그래서 저는 버그를 찾으려고 노력하고, 찾은 버그에 대한 수정을 하도록 하겠습니다.

PS. I think Some libraries have some bugs on East Asian Languages, I’ll try to find the bug and patch it about East Asian Languages.

--

--

DaeHyun Sung(성대현,成大鉉,ソン・デヒョン)

LibreOffice Korean Team,GNU,KDE Contributor,GNOME Foundation Member, My native language is Korean(한국어) My hobby is Learning Language(English,中國語(繁體中文,简体中文),日本語)