Skip to content

charset 1251 problem #509

Closed
Closed

Description

@sakirsa

Hi. I encountered a problem with the encoding. Cyrillic does not display, how to collect data in the encoding 1251. tryed to use iconv, but Fatal error: Uncaught TypeError: iconv(): Argument #3 ($string) must be of type string, Embed\Extractor given

Activity

  1. oscarotero commented on Dec 4, 2022

    @oscarotero
    Collaborator

    Can I have an URL to reproduce this?

  2. sakirsa commented on Dec 4, 2022

    @sakirsa
    Author

    https://feedster.ru/emb.php to check if cloudflare blocks

  3. parrycarry commented on Dec 4, 2022

    @parrycarry

    Oooo, I too would like to see a solution for this. The Cyrillic is completely voided when the page isn't UTF-8.

  4. oscarotero commented on Dec 4, 2022

    @oscarotero
    Collaborator

    Embed uses this parser to convert the HTML to DOMDocuments and deal with encoding issues.

    The function is used here. I've forced the encoding in the second argument and it works fine:

    $this->document = !empty($html) ? Parser::parse($html, "windows-1251") : new DOMDocument();

    So probably the automatic encoding detection of the parser doesn't work fine. Not sure how to fix it and I don't have much time to dig into this.

    If anyone wants to work on a PR to fix it, it's very appreciated.

  5. parrycarry commented on Dec 4, 2022

    @parrycarry

    I haven't thoroughly tested this... but $detected = $encoding ?? mb_detect_encoding($html, NULL, true); seems to fix the problem.... The Windows-1251 Cyrillic shows up as well as UTF-8 Cyrillic no problem...

  6. Vitorinox commented on Oct 31, 2026

    @Vitorinox
    Collaborator

    Hi @sakirsa, thanks for the report. The reported 4pda page declares windows-1251, and Cyrillic text renders correctly since #559. Guessing the encoding of pages that don't declare it is out of scope for a patch release. Feel free to reopen with a URL that still fails on the latest release (v4.6.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions