Cent5 or RHEL 5 에서의 authconfig 문자 깨짐 해결
글쓴이: 김정균 / 작성시간: 수, 2008/04/23 - 7:49오후
CentOS 5 나 RHEL 5 에서 euc-kr locale 을 사용할 경우 authconfig나 authconfig-tui 를 실행하면 한글이 깨지는 문제가 있습니다. 이는 authconfig 에서 mo 파일을 utf8 로 변경을 시도해서 발생하는 문제입니다. 이를 해결하기 위해서 다음과 같이 패치를 하시면 됩니다.
일단 locale 이 UTF8 을 사용하시거나 별로 관심 없으면 skip 하시기 바랍니다. 제가 잊어버리지 않기 위한 기록으로 남겨 놓습니다.
diff -ruNp authconfig-5.3.12.org/authconfig.py authconfig-5.3.12/authconfig.py
--- authconfig-5.3.12.org/authconfig.py 2006-10-21 03:09:34.000000000 +0900
+++ authconfig-5.3.12/authconfig.py 2008-04-23 19:40:45.000000000 +0900
@@ -769,7 +769,14 @@ class AuthconfigTUI(Authconfig):
if __name__ == '__main__':
signal.signal(signal.SIGINT, signal.SIG_DFL)
- textdomain("authconfig")
+
+ if ( os.environ.has_key('LANG') and os.environ['LANG'] == 'ko_KR.euckr' ) :
+ del _, textdomain
+ cat = gettext.Catalog ('authconfig', localedir='/usr/share/locale')
+ _ = cat.gettext
+ else :
+ textdomain("authconfig")
+
if runsAs("authconfig-tui"):
# deprecated TUI
module = AuthconfigTUI()좀 더 유연하게 짤 수 있을 거 같은데, 제가 python 문법에 아직 익숙하지를 않아서 일단 나가야 하는 관계로 대충 만들었습니다. 일단 나갔다 와서 좀더 유연하게 해 볼 생각입니다.


댓글
코드를 좀 잘 읽어서
코드를 좀 잘 읽어서 제대로 수정해 보았습니다. 이 버그는 https://bugzilla.redhat.com/show_bug.cgi?id=443956 에 보고를 해 놓은 상태입니다.
diff -urNp authconfig-5.3.12.org/authconfig.py authconfig-5.3.12/authconfig.py --- authconfig-5.3.12.org/authconfig.py 2006-10-21 03:09:34.000000000 +0900 +++ authconfig-5.3.12/authconfig.py 2008-04-24 19:19:24.000000000 +0900 @@ -23,9 +23,13 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # +import locale import authinfo, acutil import gettext, os, signal, sys -from rhpl.translate import _, textdomain +from rhpl.translate import _, N_, textdomain_codeset +locale.setlocale(locale.LC_ALL, "") +textdomain_codeset('authconfig', locale.nl_langinfo(locale.CODESET)) + from optparse import OptionParser def runsAs(name): @@ -769,7 +773,6 @@ class AuthconfigTUI(Authconfig): if __name__ == '__main__': signal.signal(signal.SIGINT, signal.SIG_DFL) - textdomain("authconfig") if runsAs("authconfig-tui"): # deprecated TUI module = AuthconfigTUI()댓글 달기