diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java
index 6118fd4ff61..ea7a4d69c5e 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java
@@ -17,13 +17,16 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrlPattern;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -120,6 +123,35 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
TestUtil.clearAllStaticFieldsForUnitTest();
}
+
+ @Test
+ public void testSearchByExtendedChars() throws Exception {
+ for (int i = 0; i < 10; i++) {
+ Patient p = new Patient();
+ p.addName().addFamily("Jernelöv");
+ p.addIdentifier().setValue("ID" + i);
+ myPatientDao.create(p, mySrd);
+ }
+
+ String uri = ourServerBase + "/Patient?name=" + URLEncoder.encode("Jernelöv", "UTF-8") + "&_count=5&_pretty=true";
+ ourLog.info("URI: {}", uri);
+ HttpGet get = new HttpGet(uri);
+ CloseableHttpResponse resp = ourHttpClient.execute(get);
+ try {
+ assertEquals(200, resp.getStatusLine().getStatusCode());
+ String output = IOUtils.toString(resp.getEntity().getContent());
+ ourLog.info(output);
+
+ assertThat(output, containsString(""));
+ assertThat(output, containsString(""));
+ } finally {
+ IOUtils.closeQuietly(resp.getEntity().getContent());
+ }
+
+
+ }
+
+
@Override
public void before() throws Exception {
super.before();
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerSearchDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerSearchDstu2Test.java
index fd420833fb6..652f32df1cc 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerSearchDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerSearchDstu2Test.java
@@ -2,6 +2,7 @@ package ca.uhn.fhir.rest.server;
import static org.junit.Assert.assertEquals;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -57,6 +58,18 @@ public class ServerSearchDstu2Test {
assertEquals("param1value", ourLastRef.getValue());
}
+ @Test
+ public void testSearchWithEncodedValue() throws Exception {
+ HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/?param1=" + URLEncoder.encode("Jernelöv", "UTF-8"));
+ HttpResponse status = ourClient.execute(httpGet);
+ String responseContent = IOUtils.toString(status.getEntity().getContent());
+ IOUtils.closeQuietly(status.getEntity().getContent());
+ ourLog.info(responseContent);
+ assertEquals("searchParam1", ourLastMethod);
+ assertEquals("Jernelöv", ourLastRef.getValue());
+ }
+
+
@Test
public void testSearchParam2() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/?param2=param2value&foo=bar");
diff --git a/src/site/xdoc/doc_rest_server.xml b/src/site/xdoc/doc_rest_server.xml
index e35f54be1c9..3dd5f547b79 100644
--- a/src/site/xdoc/doc_rest_server.xml
+++ b/src/site/xdoc/doc_rest_server.xml
@@ -604,6 +604,15 @@
+
+
+