Encodes each character in the String as an XML character.
"abc".xml_encode # => "abc"
Zero-padding:
"abc".xml_encode(zero_pad: true) # => "abc"
Hexadecimal encoded characters:
"abc".xml_encode(format: :hex) # => "abc"
Uppercase hexadecimal encoded characters:
"abc\xff".xml_encode(format: :hex, case: :upper) # => "abcÿ"
Parameters:
Additional keyword arguments.
Options Hash (**kwargs):
The numeric format for the escaped characters.
Controls whether the escaped characters will be left-padded with up to seven 0 characters.
0
Controls whether to output lowercase or uppercase XML special characters. Defaults to lowercase hexadecimal.
Returns:
The XML encoded String.
See Also:
Since:
1.0.0
118 119 120
# File 'lib/ronin/support/encoding/xml/core_ext/string.rb', line 118 def xml_encode(**kwargs) Ronin::Support::Encoding::XML.encode(self,**kwargs) end