nowa-top4r 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/top4r/client/base.rb +1 -1
- data/lib/top4r/ext/stdlib.rb +11 -1
- data/lib/top4r/version.rb +1 -1
- metadata +1 -1
data/lib/top4r/client/base.rb
CHANGED
@@ -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
|
|
data/lib/top4r/ext/stdlib.rb
CHANGED
@@ -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