diff options
author | lado <herrlado@gmail.com> | 2011-11-14 22:24:52 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2011-11-14 22:24:52 +0100 |
commit | 973ba768be6ffb8392fea69c3ba86be9c2165230 (patch) | |
tree | 3b612363e44bead9ba956b2e7b23359a597c1e80 /vdrmanager | |
parent | b54f30f13429b7e75a51763267f5c17535f839f5 (diff) | |
download | vdr-manager-973ba768be6ffb8392fea69c3ba86be9c2165230.tar.gz vdr-manager-973ba768be6ffb8392fea69c3ba86be9c2165230.tar.bz2 |
added encoding support
Diffstat (limited to 'vdrmanager')
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java | 9 | ||||
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java | 12 |
2 files changed, 19 insertions, 2 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java index de45363..ec96eeb 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java @@ -148,6 +148,13 @@ public class Preferences { */ private int timeout; + private String encoding = "utf-8"; + + + public String getEncoding() { + return encoding; + } + public int getConnectionTimeout() { return connectionTimeout; } @@ -588,6 +595,8 @@ public class Preferences { prefs.streamingPassword = getString(context, R.string.streaming_password_key, ""); + prefs.encoding = getString(context, R.string.vdr_encoding_key, "utf-8"); + thePrefs = prefs; } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java index ce7d278..7423a26 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java @@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.UnsupportedEncodingException; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketTimeoutException; @@ -280,8 +281,15 @@ public abstract class SvdrpClient<Result> { // remember char lineBytes.write(c); } - - return lineBytes.toString(); + + String line = null; + try{ + line = lineBytes.toString(Preferences.get().getEncoding()); + } catch(UnsupportedEncodingException usex){ + Log.w(TAG, usex); + line = lineBytes.toString(); + } + return line; } public void runCommand(final String command) throws SvdrpException { |