emsearcy / fluent-plugin-gelf

Buffered fluentd output plugin to GELF (Graylog2)
Apache License 2.0
33 stars 57 forks source link

Support various charsets #12

Closed knqyf263 closed 8 years ago

emsearcy commented 8 years ago

Thanks! This is a different way to fix an issue that was also addressed by pull request #9. At first glance, I think #12 is better but I've asked the other contributor to comment on this first.

knqyf263 commented 8 years ago

Thanks for your reply! OK, I'm looking forward to hearing from you.

emsearcy commented 8 years ago

Not only does "toutf8" not work on non-strings, but it doesn't preserve data like this ç (I guess because it's a kanji converter library):

irb(main):001:0> require 'kconv'
=> true
irb(main):002:0> a = "abç"
=> "abç"
irb(main):003:0> a.force_encoding('ascii')
=> "ab\xC3\xA7"
irb(main):004:0> a.force_encoding('utf-8')
=> "abç"
irb(main):005:0> a.force_encoding('ascii')
=> "ab\xC3\xA7"
irb(main):006:0> a.toutf8
=> "ab巽"