regular expressions are usually ASCII-encoded, so force_encoding the content of a Node to the encoding of the regular expression is wrong.
This commit is contained in:
parent
a210aff210
commit
d6953cbfd3
@ -23,6 +23,7 @@ class Tokenizer #:nodoc:
|
||||
|
||||
# Create a new Tokenizer for the given text.
|
||||
def initialize(text)
|
||||
text.encode! if text.encoding_aware?
|
||||
@scanner = StringScanner.new(text)
|
||||
@position = 0
|
||||
@line = 0
|
||||
|
@ -267,14 +267,12 @@ def assert_select(*args, &block)
|
||||
if match_with = equals[:text]
|
||||
matches.delete_if do |match|
|
||||
text = ""
|
||||
text.force_encoding(match_with.encoding) if text.respond_to?(:force_encoding)
|
||||
stack = match.children.reverse
|
||||
while node = stack.pop
|
||||
if node.tag?
|
||||
stack.concat node.children.reverse
|
||||
else
|
||||
content = node.content
|
||||
content.force_encoding(match_with.encoding) if content.respond_to?(:force_encoding)
|
||||
text << content
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user