ericnewton76 / gmaps-api-net

C# google maps api interface for interacting with the backend web services for Google Maps
Apache License 2.0
284 stars 149 forks source link

ToUri encodes | character as %7C #89

Open ericnewton76 opened 7 years ago

ericnewton76 commented 7 years ago

Created this issue to get feedback from anybody

The types StaticMapRequest.ToUri() method can return a pipe character '|' which is encoded as %7C on a url, but this isn't exactly correct behavior. The root of the problem is utilizing the core System.Uri class which doesn't get the reserved character set right, according to the RFC 3986 which specifically defines the list of reserved characters, and pipe isn't one of them.

Unfortunately, System.Uri.PathAndQuery will return pipe '|' encoded but ToString() returns it unencoded...

This affects the tests, specifically StaticMapRequestTests.cs#L186 in Points_Two() test method.

Is there any proper RFC 3986 url encoders out there?

ericnewton76 commented 7 years ago

When looking on nuget.org, search reveals several "proper" RFC 3986 implementations...

@richardthombs or perhaps https://github.com/balazsbotond/FluentUriBuilder instead of the internal QueryStringBuilder and do any

richardthombs commented 7 years ago

I don't get it - that test is passing and the expected result contains a "|" character, which is what we want, right?