Skip to content

Commit

Permalink
solve charset problem when receiving message in app
Browse files Browse the repository at this point in the history
* specified encoding (UTF-8) at other places
metasfresh/metasfresh-edi-legacy#6
  • Loading branch information
metas-ts committed Jan 11, 2020
1 parent 6653f38 commit f7d30ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -2,6 +2,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.LocalDate;
Expand Down Expand Up @@ -285,7 +286,7 @@ private static byte[] toByteArray(final List<String> lines)
{
lines.stream()
.map(s -> s + "\n")
.map(String::getBytes)
.map(s->s.getBytes(StandardCharsets.UTF_8))
.forEach(bytes -> {
try
{
Expand Down
Expand Up @@ -2,6 +2,7 @@

import java.awt.Color;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
Expand Down Expand Up @@ -270,7 +271,7 @@ else if (valueObj instanceof Clob)
{
final Clob lob = (Clob)valueObj;
final long length = lob.length();
valueBytes = lob.getSubString(1, (int)length).getBytes();
valueBytes = lob.getSubString(1, (int)length).getBytes(StandardCharsets.UTF_8);
}
else if (valueObj instanceof Blob)
{
Expand All @@ -280,7 +281,7 @@ else if (valueObj instanceof Blob)
}
else if (valueObj instanceof String)
{
valueBytes = ((String)valueObj).getBytes();
valueBytes = ((String)valueObj).getBytes(StandardCharsets.UTF_8);
}
else if (valueObj instanceof byte[])
{
Expand Down

0 comments on commit f7d30ae

Please sign in to comment.