baidu_web 0.2.4 → 0.2.5

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/baidu_web.rb CHANGED
@@ -5,6 +5,7 @@ require 'mechanize'
5
5
  require 'hpricot'
6
6
  require 'open-uri'
7
7
  require 'cgi'
8
+ require 'iconv'
8
9
  require "baidu_web/version"
9
10
  require "baidu_web/record"
10
11
  require "baidu_web/extension_key"
@@ -16,12 +17,11 @@ module BaiduWeb
16
17
  def search(key_word, options)
17
18
  result = {:record_arr => [], :ext_key_arr => [], :source => 'web'}
18
19
 
19
- #@ic = Iconv.new("UTF-8//IGNORE", "GBK//IGNORE")
20
-
20
+ @ic2 = Iconv.new('gb2312//IGNORE', 'UTF-8//IGNORE')
21
21
  @key_word = key_word
22
22
  return result if @key_word.blank?
23
23
  #uri parser key word
24
- @key_word = CGI.escape(@key_word)
24
+ @key_word = CGI.escape(@ic2.iconv(@key_word))
25
25
 
26
26
  #determine how many records display on one page. (same as www.baidu.com/?<some params>&rn=50)
27
27
  @per_page = options[:per_page]
@@ -1,3 +1,3 @@
1
1
  module BaiduWeb
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baidu_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: