Permalink
Browse files

Encoding for data values. Scandinavian characters should now work

  • Loading branch information...
1 parent 1633ac1 commit 49f2fd3cbc6b98173fa7ace6ef800f6b53440476 Julius de Bruijn committed Dec 20, 2010
Showing with 4 additions and 2 deletions.
  1. +1 −0 CHANGELOG
  2. +1 −1 Rakefile
  3. +2 −1 lib/c2dm_on_rails/libs/connection.rb
View
1 CHANGELOG
@@ -1 +1,2 @@
+0.1.6 Encoding for data values. Scandinavian characters now working.
0.1.5 Initial release
View
2 Rakefile
@@ -2,7 +2,7 @@ require 'rubygems'
require 'rake'
require 'echoe'
-Echoe.new('c2dm_on_rails', '0.1.5') do |p|
+Echoe.new('c2dm_on_rails', '0.1.6') do |p|
p.description = "Android push notifications on Rails."
p.url = "http://github.com/pimeys/c2dm_on_rails"
p.author = "Julius de Bruijn"
View
3 lib/c2dm_on_rails/libs/connection.rb
@@ -1,5 +1,6 @@
require 'gdata'
require 'net/https'
+require 'uri'
module C2dm
module Connection
@@ -9,7 +10,7 @@ def send_notification(noty, token)
headers = { "Content-Type" => "application/x-www-form-urlencoded",
"Authorization" => "GoogleLogin auth=#{token}" }
- message_data = noty.data.map{|k, v| "&data.#{k}=#{v}"}.reduce{|k, v| k + v}
+ message_data = noty.data.map{|k, v| "&data.#{k}=#{URI.escape(v)}"}.reduce{|k, v| k + v}
data = "registration_id=#{noty.device.registration_id}&collapse_key=#{noty.collapse_key}#{message_data}"
data = data + "&delay_while_idle" if noty.delay_while_idle

0 comments on commit 49f2fd3

Please sign in to comment.