# File rexml/source.rb, line 81 def encoding(str) if str=~/^\376\377/ 'UTF16' #unicode big endian elsif str=~/^\377\376/ 'UNILE' #unicode litle endian elsif str=~/([\300-\377][\200-\277])/ #not a guaranteed test won't detect random pairs 'UTF8' else 'ASC' end end