Myhtml::Utils::DetectEncoding
Class methods
detect(pointer, bytesize)
Sourcedetect?(pointer, bytesize)
SourceDetect encoding from header example: Myhtml::Utils::DetectEncoding.from_header(headers["Content-Type"]) # => MyHTML_ENCODING_WINDOWS_1251 Myhtml::Utils::DetectEncoding.from_header("text/html; charset=Windows-1251") # => MyHTML_ENCODING_WINDOWS_1251
from_header?(header) : Lib::MyEncodingList | Nil
Sourcefrom_meta(pointer, bytesize)
Sourcefrom_meta(content : String)
Detect encoding from meta tag in content example: Myhtml::Utils::DetectEncoding.from_meta(content) # => MyHTML_ENCODING_WINDOWS_1251 Myhtml::Utils::DetectEncoding.from_meta(%Q{ <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />}) # => MyHTML_ENCODING_WINDOWS_1251
from_meta?(pointer, bytesize)
Source