Method: Owasp::Esapi::Codec::XmlCodec#parse_number
- Defined in:
- lib/codec/xml_codec.rb
#parse_number(input) ⇒ Object
parse a number out of the encoded value
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/codec/xml_codec.rb', line 106 def parse_number(input) #:nodoc: result = '' missing_semi = true while input.next? c = input.peek if c =~ /\d/ result << c input.next elsif c == ';' input.next break; elsif not c =~ /\d/ return nil else break; end end begin i = result.to_i return i.chr(Encoding::UTF_8) if i >= START_CODE_POINT and i <= END_CODE_POINT rescue Exception => e end nil end |