whisperfish / rust-phonenumber

Library for parsing, formatting and validating international phone numbers.
Apache License 2.0
156 stars 55 forks source link

00-prefixed international numbers don't parse #29

Open rubdos opened 3 years ago

rubdos commented 3 years ago
let n = "0032474123456";
assert!(phonenumber::parse(None, n).is_ok());

I would expect this to yield +32474123456, but it seemingly does not: it yields InvalidCountryCode (which could've parsed as Belgium instead).

rustonaut commented 3 years ago

This matches the behavior of the official Google libphonenumber Java library.

I will investigate it anyway as it seems a bit strange.

On Fri, Nov 20, 2020, 18:49 Ruben De Smet notifications@github.com wrote:

let n = "0032474123456";assert!(phonenumber::parse(None, n).is_ok());

I would expect this to yield +32474123456, but it seemingly does not: it yields InvalidCountryCode (which could've parsed as Belgium instead).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rustonaut/rust-phonenumber/issues/29, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2HJEILTRPIODFRZQIPFP3SQ2T2XANCNFSM4T5CJ76A .

rustonaut commented 3 years ago

And the Google libphonenumber demo rejected my own phone number..., Definitely something strange going one there.

On Fri, Nov 20, 2020, 21:09 Philipp Korber philippkorber@gmail.com wrote:

This matches the behavior of the official Google libphonenumber Java library.

I will investigate it anyway as it seems a bit strange.

On Fri, Nov 20, 2020, 18:49 Ruben De Smet notifications@github.com wrote:

let n = "0032474123456";assert!(phonenumber::parse(None, n).is_ok());

I would expect this to yield +32474123456, but it seemingly does not: it yields InvalidCountryCode (which could've parsed as Belgium instead).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rustonaut/rust-phonenumber/issues/29, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2HJEILTRPIODFRZQIPFP3SQ2T2XANCNFSM4T5CJ76A .