관리 메뉴

김종권의 iOS 앱 개발 알아가기

[iOS - swift] NFC, NFD (한글 자소 분리 해결) 본문

iOS 응용 (swift)

[iOS - swift] NFC, NFD (한글 자소 분리 해결)

jake-kim 2020. 8. 30. 00:12

NFD


Mac OS에서 한글을 저장하는 방식 : NFD(Normalization Form Canonical Decomposition)

"한글.txt"저장 -> "ㅎㅏㄴㄱㅡㄹ.txt"로 풀어서 유니코드로 저장

ex) 보통 mac에서 window로 파일을 전송할 때, window에서 파일을 열어보면 한글 자소가 분리되어 있는걸 발견

 

NFC


Windows OS에서 한글을 저장하는 방식: NFC(Normalization Form Canonical Composition)

"한글.txt"저장 -> 그대로 병합하여 유니코드로 저장

 

swift에서 UILabel에 문구를 넣을 때 NFD로 표현되는 경우 - NFC로 변환


let sample = "한글"
lblTitle.text = sample.precomposedStringWithCanonicalMapping // NFD -> NFC

 

Comments