Fix counting bytes instead of chars
Merge pull request #665 from ogail/master

Fix GB18030 issues for PHP SDK