Change usages of ToLower into ToLowerInvariant #33
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.
This fixes a very hard-to-spot bug where Web3Auth & OpenLogin started to give various configuration errors on some specific devices. Here is where we reported it: https://web3auth.io/community/t/invalid-constructor-params-invalid-environment-settings/6643
It turns out all those devices were Turkish, and the character "ı" (or "dotless i" as non-Turkish people would say) was the reason.
You see, in Turkish, lowercasing/uppercasing rules are different, because we have a distinction between "I" and "İ" where "I".ToLower() == "ı" and "İ".ToLower() == "i" which makes sense in Turkish, and "I".ToLower() == "i" makes sense for any other language, but obviously these two rules don't mix well. And ToLower() uses the current culture information of the device. Which can make network.ToString().ToLower() into "maınnet" and buildEnv.ToString() into "productıon" "stagıng" or "testıng".
To sum up: ToLower uses current device's region settings for lowercasing a string, which can be different for some Turkic languages. ToLowerInvariant is what should be used where this behavior doesn't make sense.