使用python编码中文时,提示不支持编码GB2312

原因:

 由于编译python源码时,把`--disable-codec-cjk`加上了,导致不支持`chinese/japanses/korea`字符集。

解决办法:

  1. 如果是自己从源码编译的,把–disable-codec-cjk选项去掉即可。
  2. 如果使用的是buildroot,则执行make menuconfig选中cjk字符集,重新编译即可。
   Target packages > Interpreter languages and scripting > core python modules
      [*] codecscjk module  

Related Posts