UnicodeEncodeError
gpeddler opened this issue · comments
정유진 commented
cases
- 동아・한신아파트
Jung Winter commented
>>> a = '동아・한신아파트'
>>> a.encode('euc-kr')
UnicodeEncodeError: 'euc_kr' codec can't encode character '\u30fb' in position 2: illegal multibyte sequence
에러 재현 확인
아래처럼 해결 가능
>>> a.encode('euc-kr', errors='ignore').decode('euc-kr')
'동아한신아파트'
>>> a.encode('euc-kr', errors='replace').decode('euc-kr')
'동아?한신아파트'
위 로직이 kproperty
에 반영되어야함
Jung Winter commented
ignore
시키는것과 default인 strict
에서 발생하는 UnicodeError
를 catch해 KFormatError
를 발생시키는것 중에 어떤게 나을까요? 혹은 anything else? @sunghyunzz
이 에러를 과연 K-Format
에서 핸들링해야하는가 에 대한 논의도 좋습니당
Jung Winter commented
3가지 Enum 타입 제공. strict
, ignore
, replace
. 기본은 ignore
.
replace
의 확장성까지는 일단 고려하지 않기로 메인테이너(@sunghyunzz )와 합의
ShinYoungMin commented
생성자에 errors를 두는 방식으로 구현해보겠습니다..