Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50e92284 authored by Raph Levien's avatar Raph Levien
Browse files

Preserve leading "+" in phone numbers

The normalizeNumber method in PhoneNumberUtils preserves a leading "+"
but only if it's the first character in the string. Thus it gets
dropped if there is leading punctuation such as "(". This patch
preserves the leading "+" as long as it would be the first character
in the normalized phone number.

Bug: 18418335
Change-Id: Ifcb1d3dd6c2943c729f570e7f3c90d1da9ee8b4b
parent 613fffcd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1503,7 +1503,7 @@ public class PhoneNumberUtils
            int digit = Character.digit(c, 10);
            if (digit != -1) {
                sb.append(digit);
            } else if (i == 0 && c == '+') {
            } else if (sb.length() == 0 && c == '+') {
                sb.append(c);
            } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
                return normalizeNumber(PhoneNumberUtils.convertKeypadLettersToDigits(phoneNumber));