Set proper encoding for files with utf-8 in them

Ruby 1.9 default source encoding is ASCII, and if there are non-ascii in
it, will raise error. Add a proper encoding as coding comment at the 1st
line will fix this issue.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Bugfix: results of simple and rmmseg have unmatched size

Ruby 1.8 has no native unicode support, so we need a trick to get the
proper size of a Chinese string. If not, the returned array of Simple
and MMseg backend have different size, and which leads to wrong result.
E.g.

    Input: '非词感谢party, 感谢guo家!'

    Result of Simple backend:
        ["fei", "ci", "gan", "xie", "party", "gan", "xie", "guo", "jia"]

    Result of MMseg backend:
        [nil, nil, nil, nil, nil, nil, "gan", "xie", "party", "gan", "xie", "guo", nil, nil, nil]

    After apply patch (result of MMseg) on base (result of Simple):
        ["fei", "ci", "gan", "xie", "party,", "gan", "gan", "xie", "party!"]

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Replace accent character using sub instead of tr

When replace accent character in PinYin with normal English character,
do not use "tr", but use "sub" instead. Because for ruby 1.8, a accent
character is treat as two or more characters and when replace using
"tr", it will be replaced with two or more normal characters.
E.g.

    Input: jiǎ
    Replace with tr:  jiaa3
    Replace with sub: jia3

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Merge pull request #10 from jiangxin/jx/ruby-compatible-fix

Jx/ruby compatible fix
update Contributors