Skip to content

Allow specifying the HTML input encoding on the CLI - #322

Open
yushuosun wants to merge 1 commit into
matthewwithanm:developfrom
yushuosun:fix/cli-input-encoding
Open

yushuosun wants to merge 1 commit into
matthewwithanm:developfrom
yushuosun:fix/cli-input-encoding

Conversation

@yushuosun

Copy link
Copy Markdown

Related to #207. On a UTF-8 system, passing an ISO-8859-1 file containing <p>6 ÷ 2</p> to the CLI raises UnicodeDecodeError on byte 0xf7 when Beautiful Soup reads the text stream. The issue does not identify which entry point the reporter used. This change addresses the command-line case.

With markdownify --input-encoding iso-8859-1 input.html, the output is 6 ÷ 2. The same option works with piped input, including an explicit dash. The default still uses the usual Python file or stdin encoding.

Verified on Windows with Python 3.13. The full pytest suite passed (98 tests), including subprocess regressions for all three input forms. The repository flake8 command passed.

Copilot AI balanced review requested due to automatic review settings November 29, 2026 12:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants