Author Archives: Dongsheng Cai

Quick start: TTPhotoViewController (three20)

It’s hard to develop an iOS app quickly, so many details to be taken care of even a very simple Continue Reading →

PHP 5.4 released

PHP 5.4 just released a few days ago, it introduced new features I quite like: Short array syntax $langs = Continue Reading →

iOS工程文件里的的Localizable.strings

要写个自动化生成iOS语言文件的PHP脚本,用vim打开Localizable.strings发现全是乱码,还怀疑是苹果搞出来的特殊二进制文件,没想到用TextWrangler打开完全没有问题,这个文件是小头的UTF-16文件,带BOM头。这样问题就好解决了,用PHP生成文件内容,然后用mbstring转换成UTF-16加上个BOM头就成,但实验了一上午,生出来的文件总是乱码,怀疑是mbstring的问题,然后换成用iconv转码竟然就没问题了,上一小段代码: $bom = chr(255) . chr(254); $string = “\”" . $key . “\”" . ” = \”" . $value . Continue Reading →