Xah Lee <[EMAIL PROTECTED]> wrotE:

> i have a bunch of files encoded in GB18030. Is there a way to convert
> them to utf16 with python?

You will need CJKCodecs (http://cjkpython.i18n.org/), or Python 2.4,
which has them built in. Then just use them like any other codec. eg.

  f= open(path, 'rb')
  content= unicode(f.read(), 'gb18030')
  f.close()
  f= open(path, 'wb')
  f.write(content.encode('utf-16'))
  f.close()

-- 
Andrew Clover
mailto:[EMAIL PROTECTED]
http://www.doxdesk.com/

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to