nowa-top4r 0.0.14 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -123,7 +123,7 @@ class Top4R::Client
123
123
  :v => "1.0"
124
124
  })
125
125
  params = params.merge({
126
- :sign => Digest::MD5.hexdigest(params.sort {|a,b| "#{a[0]}"<=>"#{b[0]}"}.flatten.unshift(@app_secret).join).upcase
126
+ :sign => Digest::MD5.hexdigest(params.sort {|a,b| "#{a[0]}"<=>"#{b[0]}"}.flatten.unshift(@app_secret).join.to_gbk).upcase
127
127
  })
128
128
  end
129
129
 
@@ -10,8 +10,18 @@ class Hash
10
10
  result = ''
11
11
  return result if self.empty?
12
12
  self.each do |key, val|
13
- result << "#{key}=#{CGI.escape(val.to_s)}&"
13
+ result << "#{key}=#{CGI.escape(val.to_s.to_gbk)}&"
14
14
  end
15
15
  result.chop # remove the last '&' character, since it can be discarded
16
16
  end
17
+ end
18
+
19
+ class String
20
+ def to_gbk(str)
21
+ Iconv.iconv("GBK//IGNORE", "UTF-8//IGNORE", str).to_s
22
+ end
23
+
24
+ def to_utf8(str)
25
+ Iconv.iconv("UTF-8//IGNORE", "GBK//IGNORE", str).to_s
26
+ end
17
27
  end
data/lib/top4r/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Top4R::Version
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- REVISION = 14
4
+ REVISION = 16
5
5
 
6
6
  class << self
7
7
  # Returns X.Y.Z formatted version string
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nowa-top4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nowa Zhu