Skip to content


Support UTF-8 strings #11

merged 1 commit into from

2 participants


Fix bug for utf-8.

# -*- encoding: utf-8 -*-
require 'ruby-growl'
require 'ruby-growl/ruby_logo'

g = "localhost", "ruby-growl"
g.add_notification("notification", "ruby-growl Notification",
g.notify "notification", "It came from ruby-growl", "UTF-8の文字列を送信"
/Users/kunigaku/src/ruby-growl/lib/ruby-growl/gntp.rb:336:in `join': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)
    from /Users/kunigaku/src/ruby-growl/lib/ruby-growl/gntp.rb:336:in `packet'
    from /Users/kunigaku/src/ruby-growl/lib/ruby-growl/gntp.rb:376:in `packet_notify'
    from /Users/kunigaku/src/ruby-growl/lib/ruby-growl/gntp.rb:269:in `notify'
    from /Users/kunigaku/src/ruby-growl/lib/ruby-growl.rb:305:in `notify_gntp'
    from /Users/kunigaku/src/ruby-growl/lib/ruby-growl.rb:285:in `notify'
    from rg.rb:8:in `<main>'
@drbrain drbrain merged commit 6b5f04e into drbrain:master

1 check passed

Details default The Travis build passed
@drbrain drbrain added a commit that referenced this pull request
@drbrain Test for #11
The failure noted in #11 is due to using a file icon along with UTF-8
characters.  This has been recreated in a test now.
@drbrain drbrain added a commit that referenced this pull request
@drbrain Replace GNTP#load_resource with URI from --icon
There appears to be no need to download the URL as growl will do it for
us if we use the existing URI support in ruby-growl instead of loading
it manually.  This mostly reverts #11, but appears to work exactly the

/c @steakknife

Oops, @86c1eeb was mis-tagged for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 14, 2013
  1. @kunigaku

    Support UTF-8 strings

    kunigaku committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/ruby-growl/gntp.rb
2 lib/ruby-growl/gntp.rb
@@ -299,7 +299,7 @@ def packet type, headers, resources = {}
if @encrypt == 'NONE' then
packet << ["GNTP/1.0", type, "NONE", key_info].compact.join(' ')
- packet << body
+ packet << body.force_encoding("ASCII-8BIT")
encipher, iv = cipher key
Something went wrong with that request. Please try again.