diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/Encode.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/Encode.java index 2d3c74996355d..7536e366e5b9b 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/Encode.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/Encode.java @@ -95,7 +95,9 @@ public class Encode { case '.': case '_': case '~': + continue; case '?': + queryNameValueEncoding[i] = "%3F"; continue; case ' ': queryNameValueEncoding[i] = "+"; diff --git a/independent-projects/resteasy-reactive/common/runtime/src/test/java/org/jboss/resteasy/reactive/common/util/EncodeTest.java b/independent-projects/resteasy-reactive/common/runtime/src/test/java/org/jboss/resteasy/reactive/common/util/EncodeTest.java index 9e057ce31126f..c53115d687635 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/test/java/org/jboss/resteasy/reactive/common/util/EncodeTest.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/test/java/org/jboss/resteasy/reactive/common/util/EncodeTest.java @@ -15,4 +15,11 @@ void encodeEmoji() { assertEquals(encodedEmoji, Encode.encodePath(emoji)); assertEquals(encodedEmoji, Encode.encodeQueryParam(emoji)); } + + @Test + void encodeQuestionMarkQueryParameterValue() { + String uriQueryValue = "bar?a=b"; + String encoded = URLEncoder.encode(uriQueryValue, StandardCharsets.UTF_8); + assertEquals(encoded, Encode.encodeQueryParam(uriQueryValue)); + } }