url中中文字符解码
str = URI.decode(url_str)
替换非法字符
if ! str.valid_encoding? p str = str.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8')
end
url中中文字符解码
str = URI.decode(url_str)
替换非法字符
if ! str.valid_encoding? p str = str.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8')
end
转载于:https://www.cnblogs.com/xiaoff/p/8336135.html