Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v1_9_2_180) is shown here.
encode_ascii(content)public
Convert from UTF-8
# File lib/rexml/encodings/US-ASCII.rb, line 4
def encode_ascii content
array_utf8 = content.unpack('U*')
array_enc = []
array_utf8.each do |num|
if num <= 0x7F
array_enc << num
else
# Numeric entity (&#nnnn;); shard by Stefan Scholl
array_enc.concat "&\##{num};".unpack('C*')
end
end
array_enc.pack('C*')
end Related methods
- Instance methods
- check_encoding
- decode
- decode_ascii
- decode_cp1252
- decode_eucjp
- decode_iconv
- decode_sjis
- decode_unile
- decode_utf16
- decode_utf8
- encode
- encode_ascii
- encode_cp1252
- encode_eucjp
- encode_iconv
- encode_sjis
- encode_unile
- encode_utf16
- encode_utf8
- encoding=
- from_iso_8859_15
- to_iso_8859_15
- Class methods
- apply
- encoding_method
- register