Visitar URL original
configparser open UTF-8 with BOM file · Issue #116310 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260922170908/https://github.com/python/cpython/issues/116310
Skip to content
/ cpython Public

configparser open UTF-8 with BOM file #116310

Description

@jeanphilipperuijs

Bug report

Bug description:

Opening a .cfg file saved in UTF-8 with BOM throws an exception.

import configparser
config = configparser.ConfigParser()
config.read("./config_with_utf8_bom.cfg")

throws

configparser.MissingSectionHeaderError: File contains no section headers.
file: '/config_with_utf8_bom.cfg', line: 1
'\ufeff[umfufu]\n'

It is debatable if this is a bug or a feature request.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Activity

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

    type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions