Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable system locale - change from the standard (C) to system locale. #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

josch
Copy link
Contributor

@josch josch commented Dec 26, 2021

This allows libarchive (in case it is activated) to handle filenames.
We only change LC_CTYPE since libarchive only needs the charset set.
We don't use LC_ALL because it causes problems on some systems.
We restore the original LC_CTYPE after extraction to avoid side effects.
We use uselocale instead of setlocale to avoid setting LC_CTYPE globally.
See on libarchive Website for a more complete description of the issue:
libarchive/libarchive#587
https://github.com/libarchive/libarchive/wiki/Filenames
https://github.com/sbabic/swupdate/blob/master/handlers/archive_handler.c#L94

This allows libarchive (in case it is activated) to handle filenames.
We only change LC_CTYPE since libarchive only needs the charset set.
We don't use LC_ALL because it causes problems on some systems.
We restore the original LC_CTYPE after extraction to avoid side effects.
We use uselocale instead of setlocale to avoid setting LC_CTYPE globally.
See on libarchive Website for a more complete description of the issue:
 libarchive/libarchive#587
 https://github.com/libarchive/libarchive/wiki/Filenames
 https://github.com/sbabic/swupdate/blob/master/handlers/archive_handler.c#L94
@josch
Copy link
Contributor Author

josch commented Dec 26, 2021

Without it, handling a tarball in pax format containing utf8 characters in its filenames will result in this error message:

archive_read_next_header(): Pathname can't be converted from UTF-8 to current locale.

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