From 4444a04ece4c02a7bd51e8c75623f22dc12d882b Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 2 Jun 2024 16:59:16 +0900 Subject: [PATCH] Add missing encode for custom term --- lib/rexml/source.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb index 4483aecc..999f4671 100644 --- a/lib/rexml/source.rb +++ b/lib/rexml/source.rb @@ -163,6 +163,7 @@ def initialize(arg, block_size=500, encoding=nil) end def read(term = nil) + term = encode(term) if term begin @scanner << readline(term) true @@ -174,6 +175,7 @@ def read(term = nil) def read_until(term) pattern = /#{Regexp.escape(term)}/ + term = encode(term) begin until str = @scanner.scan_until(pattern) @scanner << readline(term)