module

Myhtml::Utils::DetectEncoding

Class methods

detect(pointer, bytesize)
Source
detect(content : String)

Detects encoding by trigrams slow and not 100% correct

Source
detect?(pointer, bytesize)
Source
detect?(content : String)
Source
from_header(header : String) : Lib::MyEncodingList | EncodingNotFound

Detect 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

Source
from_header?(header) : Lib::MyEncodingList | Nil
Source
from_meta(pointer, bytesize)
Source
from_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

Source
from_meta?(pointer, bytesize)
Source
from_meta?(content : String)
Source

Nested types