diff --git a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java index 1f49d6747..c49189fa2 100644 --- a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java @@ -1275,14 +1275,12 @@ public class PhoneNumberUtil { * @return the formatted phone number */ public String format(PhoneNumber number, PhoneNumberFormat numberFormat) { - if (number.getNationalNumber() == 0 && number.hasRawInput()) { + if (number.getNationalNumber() == 0) { // Unparseable numbers that kept their raw input just use that. // This is the only case where a number can be formatted as E164 without a // leading '+' symbol (but the original number wasn't parseable anyway). - // TODO: Consider removing the 'if' above so that unparseable - // strings without raw input format to the empty string instead of "+00". String rawInput = number.getRawInput(); - if (rawInput.length() > 0) { + if (rawInput.length() > 0 || !number.hasCountryCode()) { return rawInput; } }