Skip to content

Commit

Permalink
Merge pull request #71 from penland365/issue-70-fix
Browse files Browse the repository at this point in the history
Fixed Text decoding in Result of non-ASCII text.
  • Loading branch information
penland365 committed Jun 17, 2016
2 parents 3f24413 + d6af8a8 commit 0161b7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/scala/roc/postgresql/results.scala
Expand Up @@ -3,6 +3,7 @@ package postgresql

import cats.data.Xor
import cats.Show
import java.nio.charset.StandardCharsets
import roc.postgresql.failures.{ElementNotFoundFailure, UnsupportedDecodingFailure}
import roc.postgresql.server.PostgresqlMessage

Expand All @@ -27,8 +28,8 @@ final class Result(rowDescription: List[RowDescription], data: List[DataRow], cc
val column = columns(i)
column.formatCode match {
case TextFormat => {
val strValue = bytes.map(_.toChar).mkString
Text(column.name, column.columnType, strValue)
val stringValue = new String(bytes, StandardCharsets.UTF_8)
Text(column.name, column.columnType, stringValue)
}
case BinaryFormat => Binary(column.name, column.columnType, bytes)
}
Expand Down

0 comments on commit 0161b7c

Please sign in to comment.