Skip to content

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

Merged
jart merged 1 commit intojart:masterfrom
G4Vi:fake_env_locale
Aug 18, 2022
Merged

setlocale: Add fake support for locale="")#546
jart merged 1 commit intojart:masterfrom
G4Vi:fake_env_locale

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.

2 participants