make from_chars(double) parsing locale-independent#2475
Closed
metsw24-max wants to merge 1 commit into
Closed
Conversation
Owner
|
@metsw24-max thanks for the pull request! I implemented it in a better way. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Locale-dependent quality value parsing
detail::from_chars(double)hands off tostd::strtod, which reads the decimal point from the global C locale, whereas the integer overload beside it is written to stay locale-independent. Once an embedding process has runsetlocale(LC_ALL, "")into a locale that uses ',' (de, fr and others), an untrustedAccept/Accept-Encodingheader such asgzip;q=0.8is parsed asq=0becausestrtodstops at the '.', so the weight collapses to "not acceptable" and the server quietly drops gzip and skews content negotiation. The fix translates '.' to the active locale's separator before the call, restoring the locale-independent intent without pulling in a different parser. The regression test pins q-value ordering under a comma-decimal locale and skips where none is installed.