jugyo / earthquake

Twitter terminal client with streaming API support.
MIT License
661 stars 94 forks source link

App should specify encoding: utf-8 #133

Open beret opened 12 years ago

beret commented 12 years ago

As soon as I use a UTF-8 character in the config file, earthquake refuses to start, giving this error:

/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load': /home/user/.earthquake/config:5: invalid multibyte char (US-ASCII) (SyntaxError)
/home/user/.earthquake/config:5: invalid multibyte char (US-ASCII)
/home/user/.earthquake/config:5: syntax error, unexpected $end, expecting '}'
    :more_char => '…'
                     ^

To solve this, all that's needed is to put # encoding: utf-8 as the second line of bin/earthquake, right below #!/usr/bin/env ruby.

no6v commented 12 years ago

You can specify your favorite encoding, that may be utf-8 though :), at the top of your configuration file like:

$ head -n1 ~/.earthquake/config
# coding: utf-8

works fine on my environment. Would you try this?

Thanks,

beret commented 12 years ago

That works fine here. Would it make sense to include that in the standard config, since it's a common encoding now?

no6v commented 12 years ago
$ head -n2 ~/.earthquake/config | hd
00000000  23 20 63 6f 64 69 6e 67  3a 20 69 73 6f 2d 38 38  |# coding: iso-88|
00000010  35 39 2d 31 0a 45 61 72  74 68 71 75 61 6b 65 2e  |59-1.Earthquake.|
00000020  63 6f 6e 66 69 67 5b 3a  70 72 6f 6d 70 74 5d 20  |config[:prompt] |
00000030  3d 20 27 e6 e7 e8 20 27  0a                       |= '... '.|
00000039
$ locale charmap
UTF-8
$ earthquake --no-logo
æçè> 

I guess the prompt was converted automatically from iso-8859-1 to UTF-8 (due to default_external). Encoding of config file can be specified as per user's choice if it can be converted to UTF-8. Right?