Skip to content

Read config files as UTF-8 - #2226

Merged
martindurant merged 2 commits into
fsspec:masterfrom
RizgarOzan:fix/config-files-utf8
Oct 6, 2026
Merged

martindurant merged 2 commits into
fsspec:masterfrom
RizgarOzan:fix/config-files-utf8

Conversation

@RizgarOzan

Copy link
Copy Markdown
Contributor

set_conf_files reads .ini files with ConfigParser.read() and .json files with a bare open(), so both use the locale encoding. On Windows that's cp1252/cp1254 and so on, which turns a UTF-8 config value into mojibake:

# ~/.config/fsspec/conf.json, saved as UTF-8: {"proto": {"cache": "C:/Users/Müller/cache"}}
>>> fsspec.config.conf["proto"]["cache"]
'C:/Users/Müller/cache'

Both now read the files as UTF-8 (JSON has to be UTF-8 anyway), and the config docs say so. The new test fails on master on Windows; on Linux CI it passes either way since the locale there is already UTF-8.

Tested on Windows (Python 3.12, cp1254 locale): pytest fsspec/tests/test_config.py goes from 1 failed to 8 passed, and the full pytest fsspec run fails on the same tests as master. pre-commit is clean.

RizgarOzan and others added 2 commits October 4, 2026 10:19
set_conf_files opened .ini and .json files with the locale encoding, so on
Windows a UTF-8 config with non-ASCII values was read as mojibake.
@martindurant
martindurant merged commit 302122d into fsspec:master Oct 6, 2026
11 checks passed
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