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

IP uses locale-specific characters for digits in string (Android) #119

Open
MasterKenth opened this issue Dec 10, 2021 · 0 comments
Open

Comments

@MasterKenth
Copy link

MasterKenth commented Dec 10, 2021

Using getIPV4Address on Android with the device set to use a language that uses different characters than 0-9 to represent digits causes the returned string to also use those characters. Most notably are some Arabic languages that uses Arabian numerals.

For example, 10.0.2.16 is returned as ١٠.٠.٢.١٦.

This only seems to affect Android. The toString used likely is locale-aware.

While it can be good to use locale-specific representation if the IP is displayed to the user, this seems generally bad as it's inconsistent with iOS and causes issues with other systems, for example when we pass the IP along to our backend.

This probably affect other functions than getIPV4Address as well however that is the function where I stumbled upon the issue.

EDIT: did some digging and it seems to come from the use of String.format which doesn't specify the 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

No branches or pull requests

1 participant