Skip to content

mb_detect_encoding don't work with cyrillic (windows-1251, koi8-r) #2

@kzgzhn

Description

@kzgzhn

Hi.

oscarotero/Embed uses html-parser
https://github.com/oscarotero/Embed/blob/master/src/Document.php#L29

oscarotero/html-parser uses mb_detect_encoding()
https://github.com/oscarotero/html-parser/blob/master/src/Parser.php#L26

And oscarotero/Embed doesn't work with the old encodings (windows-1251, koi8-r, etc.)

if I manually specify the encoding:

//$detected = mb_detect_encoding($html); // don't work
//$detected = 'koi8-r'; // work
$detected = 'windows-1251'; // work

Can do so

  1. Parser::parse(string $html, ?string $charset = null)
  2. and https://github.com/oscarotero/Embed/blob/master/src/Document.php#L29
    specify from headers of response?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions