CouchStream: process entity as UTF-8 default tip
authorTomas Zeman <tzeman@volny.cz>
Thu, 05 May 2016 16:26:07 +0200
changeset 5 141e76d946e3
parent 4 b25c02bd6b11
CouchStream: process entity as UTF-8
src/main/scala/CouchStream.scala
--- a/src/main/scala/CouchStream.scala	Thu Nov 19 19:08:18 2015 +0100
+++ b/src/main/scala/CouchStream.scala	Thu May 05 16:26:07 2016 +0200
@@ -23,9 +23,10 @@
     import DefaultJsonProtocol._
     implicit val changesFormat = jsonFormat3(ResultRow)
 
-    def apply(entity: HttpEntity): Deserialized[ResultRow] = (Try {
-      Right(JsonParser(entity.asString).asJsObject.convertTo[ResultRow])
-    }).getOrElse(Left(MalformedContent("bad json")))
+    def apply(entity: HttpEntity): Deserialized[ResultRow] = Try {
+      Right(JsonParser(entity.asString(HttpCharsets.`UTF-8`)).asJsObject.
+        convertTo[ResultRow])
+    } getOrElse Left(MalformedContent("bad json"))
 
   }
 }