How to convert a bunch of files from Simplified Chinese into Unicode

Converted 154 files from Chinese to Unicode today. Here’s how I ended up doing it on my OS X box:

find . -name "*.cfg" -exec sh -c 'iconv -f GBK -t UTF-8 "$1" > "../new/zh_CH/$1"' -- {} \;

lhunath‘s answer to this question on Stack Overflow was instrumental in getting the syntax right.

The other half was figuring out what type of Chinese text encoding was being used in the source files. EditPad Pro for Windows was extremely helpful in this regard, as it allowed me to quickly preview what many different text encodings looked like. In the command line above, “GBK” is the source text encoding (one of several text encoding standards for Simplified Chinese).

It costs money, but BinaryMark’s Batch Encoding Converter for Windows would have also done the conversion work once I’d figured out the source text encoding was GBK.  As it stands I used the “iconv” tool which is built into OS X.

iPhoto import crash

This occurred mid-way through a photo import (happening at the same time as a sync operation via iTunes).  Result was no photos imported (but they were all still on the phone, so nothing lost). The phone disappeared from iPhoto, but was still present in iTunes.

Console says:

4/10/12 12:18:08.983 AM com.apple.launchd.peruser.501: ([0x0-0x3e13e1].com.apple.
PTPCamera[8973]) Job appears to have crashed: Illegal instruction: 4

Thought I’d post here in case anyone else has run into this issue.

Versions:

  • OS X 10.7.3 (11D50b)
  • iPhoto ’09 (8.1.2, 424)
  • iOS 5.1 (9B179)
  • iTunes 10.6.1 (7)