Sunday, September 25, 2011

Convert file encodings between UTF-8 and GB2312

  1. Check the encoding of a file with enca utility
    enca home.php
    Universal transformation format 8 bits; UTF-8
  2. Convert the encoding of the file with the GNU iconv utility (-c  omit invalid characters from output, -f from-encoding, -t to-encoding)
    iconv -c -f utf-8 -t gb2312 home.php > home.php.GB2312

No comments: