Skip to content

Percent encode unexpectedly encodes numbers #254

Description

@DanTup

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 Uri.EscapeDataString. I'm trying to do the same thing in Dart and discovered that none of them methods on the Uri class behaved correctly, but someone pointed me at this package.

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions