[go-nuts] Re: url.String() method fails to percent encode Path when certain characters are removed
Thanks for the replies! What I'm still stumped on is if I remove the fragment character, shouldn't that parse the all of the characters after 'http://host/' as part of the path? It would make sense if the encoding failed when the fragment character was included in the string, rather than removed. On Wednesday, November 16, 2016 at 7:18:54 AM UTC-6, Conner Hewitt wrote: > > Hi, > > I'm unsure if this is a bug or if this is working as expected, but wanted > to see if anyone knows what's going on exactly with this. > > Calling url.Parse() on a string containing all byte ASCII characters > (0-255 decimal), except the % (0x25) character, works as expected and > calling the String() method on it will produce a string with the Path > percent encoded properly. > > However, if you take out the # (0x23) character, percent encoding seems to > fail. This I believe is not specific to the # character, but I haven't > tested everything. > > Here's an example: https://play.golang.org/p/6KuknG9Kvx > > Any ideas? > > Thanks! > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: url.String() method fails to percent encode Path when certain characters are removed
Hello, The pound character (0x23) is the fragment identifier. I would have thought the fragment needs to be encoded as well, but from memory I'm not sure. Good luck, On Wednesday, 16 November 2016 08:18:54 UTC-5, Conner Hewitt wrote: > > Hi, > > I'm unsure if this is a bug or if this is working as expected, but wanted > to see if anyone knows what's going on exactly with this. > > Calling url.Parse() on a string containing all byte ASCII characters > (0-255 decimal), except the % (0x25) character, works as expected and > calling the String() method on it will produce a string with the Path > percent encoded properly. > > However, if you take out the # (0x23) character, percent encoding seems to > fail. This I believe is not specific to the # character, but I haven't > tested everything. > > Here's an example: https://play.golang.org/p/6KuknG9Kvx > > Any ideas? > > Thanks! > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: url.String() method fails to percent encode Path when certain characters are removed
# seperates the fragement so you are parsing two URLs with different structure: One with a fragment and one without. Fragement reasembly in String() works different than for path or query. V. Am Mittwoch, 16. November 2016 14:18:54 UTC+1 schrieb Conner Hewitt: > > Hi, > > I'm unsure if this is a bug or if this is working as expected, but wanted > to see if anyone knows what's going on exactly with this. > > Calling url.Parse() on a string containing all byte ASCII characters > (0-255 decimal), except the % (0x25) character, works as expected and > calling the String() method on it will produce a string with the Path > percent encoded properly. > > However, if you take out the # (0x23) character, percent encoding seems to > fail. This I believe is not specific to the # character, but I haven't > tested everything. > > Here's an example: https://play.golang.org/p/6KuknG9Kvx > > Any ideas? > > Thanks! > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.