diff --git a/google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java b/google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java index 3866265a3..601b52c14 100644 --- a/google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java +++ b/google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java @@ -64,10 +64,15 @@ public class PercentEscaper extends UnicodeEscaper { public static final String SAFEPATHCHARS_URLENCODER = "-_.!~*'()@:$&,;=+"; /** - * Contains the safe characters plus all reserved characters. This happens to be the safe path - * characters plus those characters which are reserved for URI segments, namely '/' and '?'. + * A string of characters that do not need to be encoded when used in URI Templates reserved + * expansion, as specified in RFC 6570. This includes the safe characters plus all reserved + * characters. + * + *
For details on escaping URI Templates using the reserved expansion, see RFC 6570 - section 3.2.3.
*/
- public static final String SAFE_PLUS_RESERVED_CHARS_URLENCODER = SAFEPATHCHARS_URLENCODER + "/?";
+ public static final String SAFE_PLUS_RESERVED_CHARS_URLENCODER =
+ SAFEPATHCHARS_URLENCODER + "/?#[]";
/**
* A string of characters that do not need to be encoded when used in URI user info part, as
diff --git a/google-http-client/src/test/java/com/google/api/client/http/UriTemplateTest.java b/google-http-client/src/test/java/com/google/api/client/http/UriTemplateTest.java
index 1a38eeafa..14ebc61b6 100644
--- a/google-http-client/src/test/java/com/google/api/client/http/UriTemplateTest.java
+++ b/google-http-client/src/test/java/com/google/api/client/http/UriTemplateTest.java
@@ -322,4 +322,30 @@ public void testExpandSeveralTemplatesNoParametersUsed() {
SortedMap