Fix replacing of , aka   so it works on 1.9
This commit is contained in:
parent
520081c93e
commit
8d2c027089
@ -45,10 +45,14 @@ module Webrat
|
|||||||
end
|
end
|
||||||
|
|
||||||
def replace_nbsp(str)
|
def replace_nbsp(str)
|
||||||
if str.respond_to?(:force_encoding)
|
if str.respond_to?(:valid_encoding?)
|
||||||
str.force_encoding('UTF-8').gsub(/\xc2\xa0/u, ' ')
|
if str.valid_encoding?
|
||||||
|
str.gsub(/\xc2\xa0/u, ' ')
|
||||||
else
|
else
|
||||||
str.gsub("\xc2\xa0", ' ')
|
str.force_encoding('UTF-8').gsub(/\xc2\xa0/u, ' ')
|
||||||
|
end
|
||||||
|
else
|
||||||
|
str.gsub(/\xc2\xa0/u, ' ')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user