{"action":"created","issue":{"url":"https://api.github.com/repos/hunterhug/GoProxy/issues/2","repository_url":"https://api.github.com/repos/hunterhug/GoProxy","labels_url":"https://api.github.com/repos/hunterhug/GoProxy/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/hunterhug/GoProxy/issues/2/comments","events_url":"https://api.github.com/repos/hunterhug/GoProxy/issues/2/events","html_url":"https://github.com/hunterhug/GoProxy/issues/2","id":264444556,"number":2,"title":"UriEncode()  must change.","user":{"login":"hunterhug","id":9883096,"avatar_url":"https://avatars1.githubusercontent.com/u/9883096?v=4","gravatar_id":"","url":"https://api.github.com/users/hunterhug","html_url":"https://github.com/hunterhug","followers_url":"https://api.github.com/users/hunterhug/followers","following_url":"https://api.github.com/users/hunterhug/following{/other_user}","gists_url":"https://api.github.com/users/hunterhug/gists{/gist_id}","starred_url":"https://api.github.com/users/hunterhug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hunterhug/subscriptions","organizations_url":"https://api.github.com/users/hunterhug/orgs","repos_url":"https://api.github.com/users/hunterhug/repos","events_url":"https://api.github.com/users/hunterhug/events{/privacy}","received_events_url":"https://api.github.com/users/hunterhug/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-11T03:19:55Z","updated_at":"2017-10-11T03:42:13Z","closed_at":null,"author_association":"OWNER","body":"URI encode every byte. UriEncode() must enforce the following rules:\r\n\r\n1. URI encode every byte except the unreserved characters: 'A'-'Z', 'a'-'z', '0'-'9', '-', '.', '_', and '~'.\r\n2. The space character is a reserved character and must be encoded as \"%20\" (and not as \"+\").\r\n3. Each URI encoded byte is formed by a '%' and the two-digit hexadecimal value of the byte.\r\nLetters in the hexadecimal value must be uppercase, for example \"%1A\".\r\n4. Encode the forward slash character, '/', everywhere except in the object key name. For example, if the object key name is photos/Jan/sample.jpg, the forward slash in the key name is not encoded.\r\nImportant\r\n\r\nThe standard UriEncode functions provided by your development platform may not work because of differences in implementation and related ambiguity in the underlying RFCs. We recommend that you write your own custom UriEncode function to ensure that your encoding will work.\r\n\r\nThe following is an example UriEncode() function in Java.\r\n\r\n```\r\npublic static String UriEncode(CharSequence input, boolean encodeSlash) {\r\n          StringBuilder result = new StringBuilder();\r\n          for (int i = 0; i < input.length(); i++) {\r\n              char ch = input.charAt(i);\r\n              if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == '_' || ch == '-' || ch == '~' || ch == '.') {\r\n                  result.append(ch);\r\n              } else if (ch == '/') {\r\n                  result.append(encodeSlash ? \"%2F\" : ch);\r\n              } else {\r\n                  result.append(toHexUTF8(ch));\r\n              }\r\n          }\r\n          return result.toString();\r\n      }\r\n\r\n```\r\n\r\nAnd Go some func:\r\n```\r\n\t/*\r\n\t\r\n\t&url.URL{Scheme:\"\", Opaque:\"\", User:(*url.Userinfo)(nil), Host:\"\", Path:\"/1* 123\", RawPath:\"/1* 123\", ForceQuery:false, RawQuery:\"a=b\", Fragment:\"\"}\r\n\t/1%2A%20123\r\n\t%2F1%2A+123%3Fa%3Db%26c%3Dd\r\n\t%2F1%2A%20123%3Fa=b&c=d\r\n\t*/\r\n\taa, e := url.Parse(\"/1* 123?a=b\") // keep / and change envery\r\n\tif e != nil {\r\n\t\tfmt.Println(e.Error())\r\n\t}\r\n\tfmt.Printf(\"%#v\\n\", aa)\r\n\tbb := getURIPath(aa)\r\n\tfmt.Println(bb)\r\n\r\n\tc := url.QueryEscape(\"/1* 123?a=b&c=d\") //   change every but '' ===> +   aws should %20\r\n\tcc := url.PathEscape(\"/1* 123?a=b&c=d\") // keep '=',\"&\"  ''===> %20\r\n\tfmt.Println(c)\r\n\tfmt.Println(cc)\r\n```"},"comment":{"url":"https://api.github.com/repos/hunterhug/GoProxy/issues/comments/335673408","html_url":"https://github.com/hunterhug/GoProxy/issues/2#issuecomment-335673408","issue_url":"https://api.github.com/repos/hunterhug/GoProxy/issues/2","id":335673408,"user":{"login":"hunterhug","id":9883096,"avatar_url":"https://avatars1.githubusercontent.com/u/9883096?v=4","gravatar_id":"","url":"https://api.github.com/users/hunterhug","html_url":"https://github.com/hunterhug","followers_url":"https://api.github.com/users/hunterhug/followers","following_url":"https://api.github.com/users/hunterhug/following{/other_user}","gists_url":"https://api.github.com/users/hunterhug/gists{/gist_id}","starred_url":"https://api.github.com/users/hunterhug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hunterhug/subscriptions","organizations_url":"https://api.github.com/users/hunterhug/orgs","repos_url":"https://api.github.com/users/hunterhug/repos","events_url":"https://api.github.com/users/hunterhug/events{/privacy}","received_events_url":"https://api.github.com/users/hunterhug/received_events","type":"User","site_admin":false},"created_at":"2017-10-11T03:42:13Z","updated_at":"2017-10-11T03:42:13Z","author_association":"OWNER","body":"RFC 3986  and  application/x-www-form-urlencoded\r\n one is '' ===> '%20'\r\none is \"====>'' '+'\r\n"}}
{"actor":{"display_login":"hunterhug"}}