lib/sxp/reader/basic.rb in sxp-1.2.0 vs lib/sxp/reader/basic.rb in sxp-1.2.1
- old
+ new
@@ -33,11 +33,11 @@
end
##
# @return [String]
def read_string
- buffer = String.new
+ buffer = ""
skip_char # '"'
until peek_char == ?" #"
buffer <<
case char = read_char
when ?\\ then read_character
@@ -55,22 +55,22 @@
when ?b then ?\b
when ?f then ?\f
when ?n then ?\n
when ?r then ?\r
when ?t then ?\t
- when ?u then read_chars(4).to_i(16).chr
- when ?U then read_chars(8).to_i(16).chr
+ when ?u then read_chars(4).to_i(16).chr(Encoding::UTF_8)
+ when ?U then read_chars(8).to_i(16).chr(Encoding::UTF_8)
when ?" then char #"
when ?\\ then char
else char
end
end
##
# @return [String]
def read_literal
grammar = self.class.const_get(:ATOM)
- buffer = String.new
+ buffer = ""
buffer << read_char while !eof? && peek_char.chr =~ grammar
buffer
end
end # Basic
end; end # SXP::Reader