Commits

Patrick Mézard committed 13a73bb Merge

Merge with r491

Comments (0)

Files changed (12)

csharp/PhoneNumbers.Test/TestPhoneNumberMatcher.cs

     new NumberTest("\uFF14\uFF11\uFF15\uFF16\uFF16\uFF16\uFF16-\uFF17\uFF17\uFF17", RegionCode.US),
     new NumberTest("2012-0102 08", RegionCode.US),  // Very strange formatting.
     new NumberTest("2012-01-02 08", RegionCode.US),
-    new NumberTest("1800-10-10 22", RegionCode.AU),  // Breakdown assistance number.
+     // Breakdown assistance number with unexpected formatting.
+    new NumberTest("1800-1-0-10 22", RegionCode.AU),
+    new NumberTest("030-3-2 23 12 34", RegionCode.DE),
+    new NumberTest("03 0 -3 2 23 12 34", RegionCode.DE),
+    new NumberTest("(0)3 0 -3 2 23 12 34", RegionCode.DE),
+    new NumberTest("0 3 0 -3 2 23 12 34", RegionCode.DE),
   };
 
         /**
     // Should be found by strict grouping but not exact grouping, as the last two groups are
     // formatted together as a block.
     new NumberTest("0800-2491234", "DE"),
+    // Doesn't match any formatting in the test file, but almost matches an alternate format (the
+    // last two groups have been squashed together here).
+    new NumberTest("0900-1 123123", RegionCode.DE),
+    new NumberTest("(0)900-1 123123", RegionCode.DE),
+    new NumberTest("0 900-1 123123", RegionCode.DE),
   };
 
         /**
             new NumberTest("0494949 ext. 49", "DE"),
             new NumberTest("01 (33) 3461 2234", RegionCode.MX),  // Optional NP present
             new NumberTest("(33) 3461 2234", RegionCode.MX),  // Optional NP omitted
+            new NumberTest("1800-10-10 22", RegionCode.AU),  // Breakdown assistance number.
+            // Doesn't match any formatting in the test file, but matches an alternate format exactly.
+            new NumberTest("0900-1 123 123", RegionCode.DE),
+            new NumberTest("(0)900-1 123 123", RegionCode.DE),
+            new NumberTest("0 900-1 123 123", RegionCode.DE),
         };
 
         [Test]
             contextPairs.Add(new NumberContext("It's cheap! Call ", " before 6:30"));
             // With a second number later.
             contextPairs.Add(new NumberContext("Call ", " or +1800-123-4567!"));
-            contextPairs.Add(new NumberContext("Call me on June 21 at", ""));  // with a Month-Day date
+            contextPairs.Add(new NumberContext("Call me on June 2 at", ""));  // with a Month-Day date
             // With publication pages.
             contextPairs.Add(new NumberContext(
             "As quoted by Alfonso 12-15 (2009), you may call me at ", ""));

csharp/PhoneNumbers.Test/TestPhoneNumberUtil.cs

         [Test]
         public void TestIsViablePhoneNumber()
         {
+            Assert.False(PhoneNumberUtil.IsViablePhoneNumber("1"));
             // Only one or two digits before strange non-possible punctuation.
-            Assert.False(PhoneNumberUtil.IsViablePhoneNumber("12. March"));
             Assert.False(PhoneNumberUtil.IsViablePhoneNumber("1+1+1"));
             Assert.False(PhoneNumberUtil.IsViablePhoneNumber("80+0"));
-            Assert.False(PhoneNumberUtil.IsViablePhoneNumber("00"));
-            // Three digits is viable.
+             // Two digits is viable.
+            Assert.True(PhoneNumberUtil.IsViablePhoneNumber("00"));
             Assert.That(PhoneNumberUtil.IsViablePhoneNumber("111"));
             // Alpha numbers.
             Assert.That(PhoneNumberUtil.IsViablePhoneNumber("0800-4-pizza"));
             Assert.That(PhoneNumberUtil.IsViablePhoneNumber("0800-4-PIZZA"));
+            // We need at least three digits before any alpha characters.
+            Assert.False(PhoneNumberUtil.IsViablePhoneNumber("08-PIZZA"));
+            Assert.False(PhoneNumberUtil.IsViablePhoneNumber("8-PIZZA"));
+            Assert.False(PhoneNumberUtil.IsViablePhoneNumber("12. March"));
         }
 
         [Test]
             // Test star numbers. Although this is not strictly valid, we would like to make sure we can
             // parse the output we produce when formatting the number.
             Assert.AreEqual(JP_STAR_NUMBER, phoneUtil.Parse("+81 *2345", RegionCode.JP));
+
+            PhoneNumber shortNumber = new PhoneNumber.Builder()
+                .SetCountryCode(64).SetNationalNumber(12L).Build();
+            Assert.AreEqual(shortNumber, phoneUtil.Parse("12", RegionCode.NZ));
         }
 
         [Test]
             }
             try
             {
+                String sentencePhoneNumber = "1 Still not a number";
+                phoneUtil.Parse(sentencePhoneNumber, RegionCode.NZ);
+                Assert.Fail("This should not parse without throwing an exception " + sentencePhoneNumber);
+            }
+            catch (NumberParseException e)
+            {
+                // Expected this exception.
+                Assert.AreEqual(ErrorType.NOT_A_NUMBER,
+                       e.ErrorType,
+                       "Wrong error type stored in exception.");
+            }
+            try
+            {
+                String sentencePhoneNumber = "1 MICROSOFT";
+                phoneUtil.Parse(sentencePhoneNumber, RegionCode.NZ);
+                Assert.Fail("This should not parse without throwing an exception " + sentencePhoneNumber);
+            }
+            catch (NumberParseException e)
+            {
+                // Expected this exception.
+                Assert.AreEqual(ErrorType.NOT_A_NUMBER,
+                       e.ErrorType,
+                       "Wrong error type stored in exception.");
+            }
+            try
+            {
+                String sentencePhoneNumber = "12 MICROSOFT";
+                phoneUtil.Parse(sentencePhoneNumber, RegionCode.NZ);
+                Assert.Fail("This should not parse without throwing an exception " + sentencePhoneNumber);
+            }
+            catch (NumberParseException e)
+            {
+                // Expected this exception.
+                Assert.AreEqual(ErrorType.NOT_A_NUMBER,
+                       e.ErrorType,
+                       "Wrong error type stored in exception.");
+            }
+            try
+            {
                 String tooLongPhoneNumber = "01495 72553301873 810104";
                 phoneUtil.Parse(tooLongPhoneNumber, RegionCode.GB);
                 Assert.Fail("This should not parse without throwing an exception " + tooLongPhoneNumber);
 
             // Invalid numbers that can't be parsed.
             Assert.AreEqual(PhoneNumberUtil.MatchType.NOT_A_NUMBER,
-                phoneUtil.IsNumberMatch("43", "3 331 6043"));
+                phoneUtil.IsNumberMatch("4", "3 331 6043"));
             Assert.AreEqual(PhoneNumberUtil.MatchType.NOT_A_NUMBER,
                 phoneUtil.IsNumberMatch("+43", "+64 3 331 6005"));
             Assert.AreEqual(PhoneNumberUtil.MatchType.NOT_A_NUMBER,
             Assert.That(phoneUtil.IsAlphaNumber("1800 six-flags"));
             Assert.That(phoneUtil.IsAlphaNumber("1800 six-flags ext. 1234"));
             Assert.That(phoneUtil.IsAlphaNumber("+800 six-flags"));
+            Assert.That(phoneUtil.IsAlphaNumber("180 six-flags"));
             Assert.False(phoneUtil.IsAlphaNumber("1800 123-1234"));
+            Assert.False(phoneUtil.IsAlphaNumber("1 six-flags"));
+            Assert.False(phoneUtil.IsAlphaNumber("18 six-flags"));
             Assert.False(phoneUtil.IsAlphaNumber("1800 123-1234 extension: 1234"));
             Assert.False(phoneUtil.IsAlphaNumber("+800 1234-1234"));
         }
     }
 }
-/*
-
-
-
-
-}
-*/

csharp/PhoneNumbers/PhoneNumberMatcher.cs

             {
                 return true;
             }
+            // If this didn't pass, see if there are any alternate formats, and try them instead.
+            var alternateFormats =
+                MetadataManager.GetAlternateFormatsForCountry(number.CountryCode);
+            if (alternateFormats != null)
+            {
+                foreach (var alternateFormat in alternateFormats.NumberFormatList)
+                {
+                    formattedNumberGroups = GetNationalNumberGroups(util, number, alternateFormat);
+                    if (checker(util, number, normalizedCandidate, formattedNumberGroups))
+                    {
+                        return true;
+                    }
+                }
+            }
             return false;
         }
 

csharp/PhoneNumbers/PhoneNumberUtil.cs

         // The symbol 'x' is allowed here as valid punctuation since it is often used as a placeholder for
         // carrier codes, for example in Brazilian phone numbers. We also allow multiple "+" characters at
         // the start.
-        // Corresponds to the following:
+        // [digits]{minLengthNsn}|
         // plus_sign*(([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])*
+        //
+        // The first reg-ex is to allow short numbers (two digits long) to be parsed if they are entered
+        // as "15" etc, but only if there is no punctuation in them. The second expression restricts the
+        // number of digits to three or more, but then allows them to be in international form, and to
+        // have alpha-characters and punctuation.
+        //
+        // Note VALID_PUNCTUATION starts with a -, so must be the first in the range.
         private static readonly String VALID_PHONE_NUMBER;
 
         // Default extension prefix to use when formatting. This will be put in front of any extension
 
             CAPTURING_EXTN_DIGITS = "(" + DIGITS + "{1,7})";
             VALID_PHONE_NUMBER =
+                DIGITS + "{" + MIN_LENGTH_FOR_NSN + "}" + "|" +
                 "[" + PLUS_CHARS + "]*(?:[" + VALID_PUNCTUATION + STAR_SIGN + "]*" + DIGITS + "){3,}[" +
                 VALID_PUNCTUATION + STAR_SIGN + VALID_ALPHA + DIGITS + "]*";
 

csharp/PhoneNumbers/Properties/AssemblyInfo.cs

 //
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("4.9.0.50")]
-[assembly: AssemblyVersion("4.9.0.50")]
-[assembly: AssemblyFileVersion("4.9.0.50")]
+// [assembly: AssemblyVersion("4.9.0.51")]
+[assembly: AssemblyVersion("4.9.0.51")]
+[assembly: AssemblyFileVersion("4.9.0.51")]

java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java

 
   /**
    * Small helper interface such that the number groups can be checked according to different
-   * criteria.
+   * criteria, both for our default way of performing formatting and for any alternate formats we
+   * may want to check.
    */
   interface NumberGroupingChecker {
     /**
     if (checker.checkGroups(util, number, normalizedCandidate, formattedNumberGroups)) {
       return true;
     }
+    // If this didn't pass, see if there are any alternate formats, and try them instead.
+    PhoneMetadata alternateFormats =
+        MetadataManager.getAlternateFormatsForCountry(number.getCountryCode());
+    if (alternateFormats != null) {
+      for (NumberFormat alternateFormat : alternateFormats.numberFormats()) {
+        formattedNumberGroups = getNationalNumberGroups(util, number, alternateFormat);
+        if (checker.checkGroups(util, number, normalizedCandidate, formattedNumberGroups)) {
+          return true;
+        }
+      }
+    }
     return false;
   }
 

java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java

   // carrier codes, for example in Brazilian phone numbers. We also allow multiple "+" characters at
   // the start.
   // Corresponds to the following:
+  // [digits]{minLengthNsn}|
   // plus_sign*(([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])*
+  //
+  // The first reg-ex is to allow short numbers (two digits long) to be parsed if they are entered
+  // as "15" etc, but only if there is no punctuation in them. The second expression restricts the
+  // number of digits to three or more, but then allows them to be in international form, and to
+  // have alpha-characters and punctuation.
+  //
   // Note VALID_PUNCTUATION starts with a -, so must be the first in the range.
   private static final String VALID_PHONE_NUMBER =
-      "[" + PLUS_CHARS + "]*(?:[" + VALID_PUNCTUATION + STAR_SIGN + "]*" + DIGITS + "){3,}[" +
+      DIGITS + "{" + MIN_LENGTH_FOR_NSN + "}" + "|" +
+      "[" + PLUS_CHARS + "]*+(?:[" + VALID_PUNCTUATION + STAR_SIGN + "]*" + DIGITS + "){3,}[" +
       VALID_PUNCTUATION + STAR_SIGN + VALID_ALPHA + DIGITS + "]*";
 
   // Default extension prefix to use when formatting. This will be put in front of any extension
       int numOfGroups = prefixMatcher.groupCount();
       String transformRule = metadata.getNationalPrefixTransformRule();
       if (transformRule == null || transformRule.length() == 0 ||
-          prefixMatcher.group(numOfGroups - 1) == null) {
+          prefixMatcher.group(numOfGroups) == null) {
         // If the original number was viable, and the resultant number is not, we return.
         if (isViableOriginalNumber &&
             !nationalNumberRule.matcher(number.substring(prefixMatcher.end())).matches()) {

java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GA

Binary file modified.

java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL

Binary file modified.

java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java

     new NumberTest("\uFF14\uFF11\uFF15\uFF16\uFF16\uFF16\uFF16-\uFF17\uFF17\uFF17", RegionCode.US),
     new NumberTest("2012-0102 08", RegionCode.US),  // Very strange formatting.
     new NumberTest("2012-01-02 08", RegionCode.US),
-    new NumberTest("1800-10-10 22", RegionCode.AU),  // Breakdown assistance number.
+    // Breakdown assistance number with unexpected formatting.
+    new NumberTest("1800-1-0-10 22", RegionCode.AU),
+    new NumberTest("030-3-2 23 12 34", RegionCode.DE),
+    new NumberTest("03 0 -3 2 23 12 34", RegionCode.DE),
+    new NumberTest("(0)3 0 -3 2 23 12 34", RegionCode.DE),
+    new NumberTest("0 3 0 -3 2 23 12 34", RegionCode.DE),
   };
 
   /**
     // Should be found by strict grouping but not exact grouping, as the last two groups are
     // formatted together as a block.
     new NumberTest("0800-2491234", RegionCode.DE),
+    // Doesn't match any formatting in the test file, but almost matches an alternate format (the
+    // last two groups have been squashed together here).
+    new NumberTest("0900-1 123123", RegionCode.DE),
+    new NumberTest("(0)900-1 123123", RegionCode.DE),
+    new NumberTest("0 900-1 123123", RegionCode.DE),
   };
 
   /**
     new NumberTest("0494949 ext. 49", RegionCode.DE),
     new NumberTest("01 (33) 3461 2234", RegionCode.MX),  // Optional NP present
     new NumberTest("(33) 3461 2234", RegionCode.MX),  // Optional NP omitted
+    new NumberTest("1800-10-10 22", RegionCode.AU),  // Breakdown assistance number.
+    // Doesn't match any formatting in the test file, but matches an alternate format exactly.
+    new NumberTest("0900-1 123 123", RegionCode.DE),
+    new NumberTest("(0)900-1 123 123", RegionCode.DE),
+    new NumberTest("0 900-1 123 123", RegionCode.DE),
   };
 
   public void testMatchesWithPossibleLeniency() throws Exception {
     contextPairs.add(new NumberContext("It's cheap! Call ", " before 6:30"));
     // With a second number later.
     contextPairs.add(new NumberContext("Call ", " or +1800-123-4567!"));
-    contextPairs.add(new NumberContext("Call me on June 21 at", ""));  // with a Month-Day date
+    contextPairs.add(new NumberContext("Call me on June 2 at", ""));  // with a Month-Day date
     // With publication pages.
     contextPairs.add(new NumberContext(
         "As quoted by Alfonso 12-15 (2009), you may call me at ", ""));

java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java

   }
 
   public void testIsViablePhoneNumber() {
+    assertFalse(PhoneNumberUtil.isViablePhoneNumber("1"));
     // Only one or two digits before strange non-possible punctuation.
-    assertFalse(PhoneNumberUtil.isViablePhoneNumber("12. March"));
     assertFalse(PhoneNumberUtil.isViablePhoneNumber("1+1+1"));
     assertFalse(PhoneNumberUtil.isViablePhoneNumber("80+0"));
-    assertFalse(PhoneNumberUtil.isViablePhoneNumber("00"));
-    // Three digits is viable.
+    // Two digits is viable.
+    assertTrue(PhoneNumberUtil.isViablePhoneNumber("00"));
     assertTrue(PhoneNumberUtil.isViablePhoneNumber("111"));
     // Alpha numbers.
     assertTrue(PhoneNumberUtil.isViablePhoneNumber("0800-4-pizza"));
     assertTrue(PhoneNumberUtil.isViablePhoneNumber("0800-4-PIZZA"));
+    // We need at least three digits before any alpha characters.
+    assertFalse(PhoneNumberUtil.isViablePhoneNumber("08-PIZZA"));
+    assertFalse(PhoneNumberUtil.isViablePhoneNumber("8-PIZZA"));
+    assertFalse(PhoneNumberUtil.isViablePhoneNumber("12. March"));
   }
 
   public void testIsViablePhoneNumberNonAscii() {
     // Test star numbers. Although this is not strictly valid, we would like to make sure we can
     // parse the output we produce when formatting the number.
     assertEquals(JP_STAR_NUMBER, phoneUtil.parse("+81 *2345", RegionCode.JP));
+
+    PhoneNumber shortNumber = new PhoneNumber();
+    shortNumber.setCountryCode(64).setNationalNumber(12L);
+    assertEquals(shortNumber, phoneUtil.parse("12", RegionCode.NZ));
   }
 
   public void testParseNumberWithAlphaCharacters() throws Exception {
                    e.getErrorType());
     }
     try {
+      String sentencePhoneNumber = "1 Still not a number";
+      phoneUtil.parse(sentencePhoneNumber, RegionCode.NZ);
+      fail("This should not parse without throwing an exception " + sentencePhoneNumber);
+    } catch (NumberParseException e) {
+      // Expected this exception.
+      assertEquals("Wrong error type stored in exception.",
+                   NumberParseException.ErrorType.NOT_A_NUMBER,
+                   e.getErrorType());
+    }
+    try {
+      String sentencePhoneNumber = "1 MICROSOFT";
+      phoneUtil.parse(sentencePhoneNumber, RegionCode.NZ);
+      fail("This should not parse without throwing an exception " + sentencePhoneNumber);
+    } catch (NumberParseException e) {
+      // Expected this exception.
+      assertEquals("Wrong error type stored in exception.",
+                   NumberParseException.ErrorType.NOT_A_NUMBER,
+                   e.getErrorType());
+    }
+    try {
+      String sentencePhoneNumber = "12 MICROSOFT";
+      phoneUtil.parse(sentencePhoneNumber, RegionCode.NZ);
+      fail("This should not parse without throwing an exception " + sentencePhoneNumber);
+    } catch (NumberParseException e) {
+      // Expected this exception.
+      assertEquals("Wrong error type stored in exception.",
+                   NumberParseException.ErrorType.NOT_A_NUMBER,
+                   e.getErrorType());
+    }
+    try {
       String tooLongPhoneNumber = "01495 72553301873 810104";
       phoneUtil.parse(tooLongPhoneNumber, RegionCode.GB);
       fail("This should not parse without throwing an exception " + tooLongPhoneNumber);
 
     // Invalid numbers that can't be parsed.
     assertEquals(PhoneNumberUtil.MatchType.NOT_A_NUMBER,
-                 phoneUtil.isNumberMatch("43", "3 331 6043"));
+                 phoneUtil.isNumberMatch("4", "3 331 6043"));
     assertEquals(PhoneNumberUtil.MatchType.NOT_A_NUMBER,
                  phoneUtil.isNumberMatch("+43", "+64 3 331 6005"));
     assertEquals(PhoneNumberUtil.MatchType.NOT_A_NUMBER,
     assertTrue(phoneUtil.isAlphaNumber("1800 six-flags"));
     assertTrue(phoneUtil.isAlphaNumber("1800 six-flags ext. 1234"));
     assertTrue(phoneUtil.isAlphaNumber("+800 six-flags"));
+    assertTrue(phoneUtil.isAlphaNumber("180 six-flags"));
     assertFalse(phoneUtil.isAlphaNumber("1800 123-1234"));
+    assertFalse(phoneUtil.isAlphaNumber("1 six-flags"));
+    assertFalse(phoneUtil.isAlphaNumber("18 six-flags"));
     assertFalse(phoneUtil.isAlphaNumber("1800 123-1234 extension: 1234"));
     assertFalse(phoneUtil.isAlphaNumber("+800 1234-1234"));
   }

java/release_notes.txt

+July 12th, 2012: libphonenumber-5.0
+* Code changes:
+  - Support for alternate formats when finding phone numbers.
+  - Allowing two-digit numbers to be parsed if they are entered in national-format with no
+    punctuation
+* Metadata changes
+  - IL, GA
+* Other
+  - Reflowed this file to 100 char width to make it unambiguous as to what the standard should be.
+
 July 6th, 2012: libphonenumber-4.9.1
 * Metadata changes
  - AR, BA, BF, CR, DE, EC, ES, KZ, MK, NC, NG, PF, SB, UZ, non-geo entity 882
- - Geocoding data updates for country calling codes 54 (AR) and 81 (JP), new
-   data for 234 (NG)
+ - Geocoding data updates for country calling codes 54 (AR) and 81 (JP), new data for 234 (NG)
 
 June 21st, 2012: libphonenumber-4.9
 * Bug fix
- - formatInOriginalFormat fixed not to add a star sign if it was not present
-   originally.
+ - formatInOriginalFormat fixed not to add a star sign if it was not present originally.
 * Metadata changes
  - BF, CZ, ES, KW
- - Non-geographical entities with calling code 882 (BebbiCell, Maritime
-   Communications, Oration Technologies, Telespazio and Thuraya)
+ - Non-geographical entities with calling code 882 (BebbiCell, Maritime Communications, Oration
+   Technologies, Telespazio and Thuraya)
  - Geocoding data updates for country calling codes 221, 224, 226, 242, 244, 245
 * Functionality changes:
- - Minimum allowed length for a national significant number (NSN) when parsing
-   changed from 3 to 2.
- - Support parsing of RFC3966-formatted strings with an isdn-subaddress or extra
-   parameters specified.
+ - Minimum allowed length for a national significant number (NSN) when parsing changed from 3 to 2.
+ - Support parsing of RFC3966-formatted strings with an isdn-subaddress or extra parameters
+   specified.
  - Allow soft hyphen to appear in phone numbers (\u00AD)
 * Testing changes:
  - Add extra unit tests for non-geographical phone number entities
 November 10th, 2011: libphonenumber-4.2
 * Code changes
  - Providing an "exact match" isEmergencyNumber method
- - Improvement to PhoneNumberMatcher: requires national prefix to be present
-   when matching national-format numbers, unless matching for a region where it
-   is explicitly marked in the metadata that they may be omitted. Applies to
-   leniency level VALID and higher.
+ - Improvement to PhoneNumberMatcher: requires national prefix to be present when matching
+   national-format numbers, unless matching for a region where it is explicitly marked in the
+   metadata that they may be omitted. Applies to leniency level VALID and higher.
  - Change formatNumberForMobileDialing not to modify the phoneNumber passed in.
 
 * Metadata changes
  - Emergency numbers added for all remaining countries
- - Collected data on which numbers we format with a national prefix are
-   commonly written without one and added this
+ - Collected data on which numbers we format with a national prefix are commonly written without one
+   and added this
  - Updates for AR, AT, BH, CZ, GR, IR, KM, LT, MX, PT, SE, SO, UG
  - Addition of SX (Sint Maarten)
 
 October 19th, 2011: libphonenumber-4.1
 * Code changes
- - Update code and metadata for countries with IDD "8~10" to accept phone
-   numbers where the "~" is omitted.
- - Modify formatInOriginalFormat to use raw_input (when present) when the number
-   is considered as invalid by the library.
- - Add ShortNumberUtil to deal with international short phone numbers, such as
-   short codes and emergency numbers.
+ - Update code and metadata for countries with IDD "8~10" to accept phone numbers where the "~" is
+   omitted.
+ - Modify formatInOriginalFormat to use raw_input (when present) when the number is considered as
+   invalid by the library.
+ - Add ShortNumberUtil to deal with international short phone numbers, such as short codes and
+   emergency numbers.
  - Increase the maximum phone-number length accepted when parsing (now set to
    16).
 
 * Metadata changes
- - Updates: BF, BN, CN, DE, DK, DO, FR, IN, KI, KW, MC, MD, ML, PA, QA, SB, UK,
-   WS
+ - Updates: BF, BN, CN, DE, DK, DO, FR, IN, KI, KW, MC, MD, ML, PA, QA, SB, UK, WS
  - Emergency number information also added to: AE, AF, AL, AM, AR, AT, AU, BA,
    BB, BD, BE, BG, BH, BO, BR, BY, CA, CH, CL, CN, CO, CR, CY, CZ, DE, DJ, DK,
    DO, DZ, EC, EE, EG, ES, FI, FJ, FO, FR, GB, GE, GF, GH, GI, GL, GR, GT, GY,
 
 October 6th, 2011: libphonenumber-4.0
 * Code changes
- - New function formatNumberForMobileDialing, which attempts to format a number in
-   such a way that the call can be connected from a mobile phone. If this is
-   impossible, for example for numbers that cannot be internationally dialled,
-   then an empty string is returned.
+ - New function formatNumberForMobileDialing, which attempts to format a number in such a way that
+   the call can be connected from a mobile phone. If this is impossible, for example for numbers
+   that cannot be internationally dialled, then an empty string is returned.
  - Fallback functionality to English for non-CJK languages for geocoding
 
 * Metadata changes
  - Enable AsYouTypeFormatter to handle long IDD and NDD.
  - Allow the presence of an IDD following a +.
  - Fix formatting of phone numbers which contain only 0s in the national number.
- - Refactored some code in geocoding including AreaCodeMap and the storage
-   strategies.
+ - Refactored some code in geocoding including AreaCodeMap and the storage strategies.
 
 * Metadata changes
  - Updates: AM, BE, BH, BJ, BR, BT, BZ, CI, CL, CN, DE, DK, DM, DZ, EC, EG, FJ,
 * Code changes
  - Fix to demo to not throw null-ptr exceptions for invalid NANPA numbers
  - Fixed AYTF to not accept plus signs in the middle of input
- - PhoneNumberMatcher improvements - added STRICT_GROUPING and EXACT_GROUPING
-   levels, numbers followed/preceded by a currency symbol will not match,
-   multiple numbers separated by phone-number punctuation will now match. ", "
-   is no longer accepted as an extension symbol when matching, only when
-   parsing. "x" is only accepted as a carrier code or extension marker, not
-   otherwise.
- - Changes to handling of leading zeroes - these will not be silently ignored
-   anymore, but will be stored as part of the number.
- - PhoneNumberOfflineGeocoder - new method to get the description of a number that assumes
-   the validity of the number has already been checked and will not re-verify it.
+ - PhoneNumberMatcher improvements - added STRICT_GROUPING and EXACT_GROUPING levels, numbers
+   followed/preceded by a currency symbol will not match, multiple numbers separated by phone-number
+   punctuation will now match. ", " is no longer accepted as an extension symbol when matching, only
+   when parsing. "x" is only accepted as a carrier code or extension marker, not otherwise.
+ - Changes to handling of leading zeroes - these will not be silently ignored anymore, but will be
+   stored as part of the number.
+ - PhoneNumberOfflineGeocoder - new method to get the description of a number that assumes the
+   validity of the number has already been checked and will not re-verify it.
  - Split geocoding US binary data into multiple files.
 
 * Metadata changes
 August 4th, 2010
 * Further improve startup performance
   - Preload no country specific metadata at startup.
-  - Stop creating the file containing mapping from country calling code to region code
-    and loading it at startup; instead, do the initialization in PhoneNumberUtil.
+  - Stop creating the file containing mapping from country calling code to region code and loading
+    it at startup; instead, do the initialization in PhoneNumberUtil.
 
 July 31th, 2010
 
 * Improve startup performance
   - Separate generated metadata binary file to one file per region
   - Preload US at start up, and load other region at the time when needed
-  - Create a file containing mapping from country calling code to region code,
-    and load it at startup
+  - Create a file containing mapping from country calling code to region code, and load it at
+    startup
   - Same change also applied to unittests
 
 July 30th, 2010