Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Percent encode unexpectedly encodes numbers #3
I'm integrating with the twitter API which describes that data should be "percent encoded". In C# I found that the method that matched Twitters docs was
This seems to work great for all the characters I've tried, except numbers:
// Dart: print(percent.encode("1".codeUnits)); // outputs %31
// C#: Console.WriteLine(Uri.EscapeDataString("1")); // outputs 1
The C# version seems to match twitter definition of "percent encoding" but I'm struggling to find detailed docs on whether this is a standard and if so, which is correct. I'm raising it here in the hope that either a) it's a bug and can be fixed or b) there's another method I want that behaves as C# does/twitter expects.
On Google+ someone pointed out that the Dart docs say this is compatible with RFC 3986, which contains:
This leads us to believe this is a bug in the implementation and they should not be encoded.
Definitely a bug. The encoder contains the following code to detect characters that should not be encoded:
It clearly fails to catch digits. Shame on whoever reviewed this!