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

setlocale: Add fake support for locale="") #546

Merged
merged 1 commit into from Aug 18, 2022
Merged

Conversation

G4Vi
Copy link
Collaborator

@G4Vi G4Vi commented Aug 18, 2022

setlocale( int category, ""); is supposed to set the category or all categories in the case of the category LC_ALL to the values specified in the environment.

Actually querying the environment would be unlikely to be helpful as we only support the C or POSIX locales, so why not fake it.

Some programs such as perl call setlocale( LC_ALL, "");, at startup expecting it to be able to set the locale from the environment and prints an error if it fails.

We could instead of this patch, actually setup the environment with LC_*="C" and change setlocale to query it, but so far this seems to work and is simpler.

Copy link
Owner

@jart jart left a comment

Choose a reason for hiding this comment

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

Thank you!

@jart jart merged commit 27416e7 into jart:master Aug 18, 2022
@G4Vi G4Vi deleted the fake_env_locale branch August 19, 2022 16:20
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.

None yet

2 participants