From 1d06411883bf297bde683690dd85cb22da3ffbae Mon Sep 17 00:00:00 2001 From: Faisal Hameed Date: Sun, 13 Mar 2016 22:45:19 +0500 Subject: [PATCH] Fixing squid:S1943 - Default system encoding should not be used. --- .../com/nutomic/syncthingandroid/activities/LogActivity.java | 2 +- .../java/com/nutomic/syncthingandroid/syncthing/GetTask.java | 2 +- .../nutomic/syncthingandroid/syncthing/SyncthingRunnable.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java index 9a2d0e72..f0818318 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java @@ -135,7 +135,7 @@ public class LogActivity extends SyncthingActivity { pb.redirectErrorStream(true); process = pb.start(); BufferedReader bufferedReader = new BufferedReader( - new InputStreamReader(process.getInputStream()), 8192); + new InputStreamReader(process.getInputStream(), "UTF-8"), 8192); StringBuilder log = new StringBuilder(); String line = ""; String sep = System.getProperty("line.separator"); diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java index 30de0a44..e4f6822b 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/GetTask.java @@ -80,7 +80,7 @@ public class GetTask extends AsyncTask { if (entity != null) { InputStream is = entity.getContent(); - BufferedReader br = new BufferedReader(new InputStreamReader(is)); + BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line; String result = ""; while ((line = br.readLine()) != null) { diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingRunnable.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingRunnable.java index 6a5e65bc..afb5a27c 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingRunnable.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingRunnable.java @@ -242,7 +242,7 @@ public class SyncthingRunnable implements Runnable { psOut.writeBytes("exit\n"); psOut.flush(); ps.waitFor(); - InputStreamReader isr = new InputStreamReader(ps.getInputStream()); + InputStreamReader isr = new InputStreamReader(ps.getInputStream(), "UTF-8"); BufferedReader br = new BufferedReader(isr); String id; while ((id = br.readLine()) != null) { @@ -312,7 +312,7 @@ public class SyncthingRunnable implements Runnable { @Override public void run() { try { - InputStreamReader isr = new InputStreamReader(is); + InputStreamReader isr = new InputStreamReader(is, "UTF-8"); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) {