Class: Android::AXMLParser

Inherits:
Object show all
Defined in:
lib/fir/util/parser/apk.rb

Instance Method Summary collapse

Instance Method Details

#original_parse_stringsObject



9
# File 'lib/fir/util/parser/apk.rb', line 9

alias_method :original_parse_strings, :parse_strings

#parse_stringsObject



11
12
13
14
15
16
17
18
19
# File 'lib/fir/util/parser/apk.rb', line 11

def parse_strings
  original_parse_strings
  # Remove illegal XML control characters from strings
  @strings = @strings.map do |str|
    next str unless str.is_a?(String)
    # Keep only valid XML characters: #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
    str.gsub(/[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD]/, '')
  end
end