Skip to content

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

@MasterKenth

Description

@MasterKenth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions