Skip to content

Strip leading UTF-8 BOM when reading INI files - #76

Open
Pitchfork-and-Torch wants to merge 1 commit into
pytest-dev:mainfrom
Pitchfork-and-Torch:cook/strip-utf8-bom
Open

Pitchfork-and-Torch wants to merge 1 commit into
pytest-dev:mainfrom
Pitchfork-and-Torch:cook/strip-utf8-bom

Conversation

@Pitchfork-and-Torch

Copy link
Copy Markdown

Summary

Windows editors often write a UTF-8 BOM. With the default encoding=\"utf-8\", that left U+FEFF on the first section line and raised ParseError: unexpected line.

Strip a leading BOM after read for both IniConfig() and IniConfig.parse(), including when content is passed via data=.

Test plan

  • test_utf8_bom_file, test_utf8_bom_in_data_string, test_parse_utf8_bom_file pass

Windows editors often write a UTF-8 BOM; with encoding=utf-8 that left
U+FEFF on the first section line and raised ParseError. Strip the BOM
after read for both IniConfig() and IniConfig.parse().

This branch has not been deployed

No deployments
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.

1 participant