[tor-commits] [metrics-web/release] Preserve UTF-8 encoding of table data.

karsten at torproject.org karsten at torproject.org
Wed May 30 13:45:11 UTC 2018


commit 50ae3c4579709fca8e95bfcab136a21de5acfe70
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Feb 7 17:35:02 2018 +0100

    Preserve UTF-8 encoding of table data.
    
    Fixes #25167.
---
 src/main/java/org/torproject/metrics/web/RObjectGenerator.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/torproject/metrics/web/RObjectGenerator.java b/src/main/java/org/torproject/metrics/web/RObjectGenerator.java
index 06177bf..c7d0041 100644
--- a/src/main/java/org/torproject/metrics/web/RObjectGenerator.java
+++ b/src/main/java/org/torproject/metrics/web/RObjectGenerator.java
@@ -14,6 +14,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -222,7 +223,7 @@ public class RObjectGenerator implements ServletContextListener {
     /* Write the table content to a map. */
     List<Map<String, String>> result = new ArrayList<>();
     try (BufferedReader br = new BufferedReader(new InputStreamReader(
-        new ByteArrayInputStream(tableBytes)))) {
+        new ByteArrayInputStream(tableBytes), StandardCharsets.UTF_8))) {
       String line = br.readLine();
       if (line != null) {
         List<String> headers = new ArrayList<>(Arrays.asList(line.split(",")));





More information about the tor-commits mailing list