encoding(X-MAC-KOREAN) problem on Python 2.5

2008.12.23 12:13 | Posted by bar4mi
It occurred when I installed Trac on my macbook. 

bash-3.2# trac-admin ./Trac/mkb initenv
Traceback (most recent call last):
  File "/opt/local/bin/trac-admin", line 8, in <module>
    load_entry_point('Trac==', 'console_scripts', 'trac-admin')()
  File "/opt/local/lib/python2.5/site-packages/trac/admin/console.py", line 1294, in run
    return admin.onecmd(command)
  File "/opt/local/lib/python2.5/site-packages/trac/admin/console.py", line 120, in onecmd
    line = to_unicode(line, encoding)
  File "/opt/local/lib/python2.5/site-packages/trac/util/text.py", line 59, in to_unicode
    return unicode(text, charset, 'replace')
LookupError: unknown encoding: X-MAC-KOREAN

According to python's issue(1276), it was fixed but my Python version(2.5) including MacPorts is not fixed. 

Python team offer the temporary patch which works great on my macbook.

It can just be inserted to 508th lines of aliases.py(/opt/local/lib/python2.5/encodings/aliases.py).

# temporary mac CJK aliases for 3.0, will be replaced in 3.1
    'x_mac_japanese'      : 'shift_jis',
    'x_mac_korean'        : 'euc_kr',
    'x_mac_simp_chinese'  : 'gb2312',
    'x_mac_trad_chinese'  : 'big5',


  1. 좋으면 좋고 싫으면 싫은 거지, 뭐가 이렇게 어렵고 복잡하냐구

  2. 정직을 잃은 자는 더 이상 잃을 것이없다.
    Topics related articles:

    http://katagiriyuuhi.tistory.com/402 新建文章 5

    http://ccongss.tistory.com/250 新建文章 7

    http://vc328512.tistory.com/58 新建文章 11

    http://simplesoul.tistory.com/category/OpenSource/SWFUpload 新建文章 6

  3. 닫혀있던 나의 어두운 마음 모두 네게 열게 예이예