Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Decoding sometimes fails when two encoded characters appear one after another. #14

Description

@davidklebanoff

The Cookies.decode( String encoded ) method sometimes fails to properly decode the given string when two encoded characters appear one after another.

For example, the decoding fails for the given string: New%20York%2C%20NY. Outputting: New York%2C NY.

The reason being that the decoding regex (%[0-9A-Z]{2})+ produces two matches %20 and %2C%20. The method then goes on to replace these matches by first searching for %20 and replacing it with the space character. It then goes on to look for %2C%20 to replace them with a comma and space, however, since all instances of %20 have been replaced by a space, the match never occurs. %2C%20 is simply left as %2c.

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions