address=self.address
response = HTTParty.get("http://api.map.baidu.com/geocoder/v2/?address=#{address}&output=json&ak=5dfe24c4762c0370324d273bc231f45a")
decode_response = ActiveSupport::JSON.decode(response)
address
里面是中文,比如“北京”
所以会报错,URI::InvalidURIError (bad URI(is not URI?):
不知道应该怎么写?
我试过address=self.address.force_encoding('utf-8')
,但是问题依旧……