diff --git a/apps/BOB/Demos/echo/echoclient/src/net/i2p/BOB/Demos/echo/echoclient/Main.java b/apps/BOB/Demos/echo/echoclient/src/net/i2p/BOB/Demos/echo/echoclient/Main.java
index ca7b8288906d227745e76410361d9e9d9952108c..313f10f2c6ed69c1a8cde80aa2ab0b6796936d98 100644
--- a/apps/BOB/Demos/echo/echoclient/src/net/i2p/BOB/Demos/echo/echoclient/Main.java
+++ b/apps/BOB/Demos/echo/echoclient/src/net/i2p/BOB/Demos/echo/echoclient/Main.java
@@ -66,7 +66,7 @@ public class Main {
 	}
 
 	static void wrtxt(OutputStream CMDout, String s) throws IOException {
-		CMDout.write(s.getBytes());
+		CMDout.write(DataHelper.getUTF8(s));
 		CMDout.write('\n');
 		CMDout.flush();
 	}
diff --git a/apps/BOB/Demos/echo/echoserver/src/net/i2p/BOB/Demos/echo/echoserver/Main.java b/apps/BOB/Demos/echo/echoserver/src/net/i2p/BOB/Demos/echo/echoserver/Main.java
index 6b7be251824859555928c5798114bbd16e7b37fd..93bd7d7533dd7dfd2e5a8a20ef47204612f2d4f1 100644
--- a/apps/BOB/Demos/echo/echoserver/src/net/i2p/BOB/Demos/echo/echoserver/Main.java
+++ b/apps/BOB/Demos/echo/echoserver/src/net/i2p/BOB/Demos/echo/echoserver/Main.java
@@ -63,7 +63,7 @@ public class Main {
 	}
 
 	static void wrtxt(OutputStream CMDout, String s) throws IOException {
-		CMDout.write(s.getBytes());
+		CMDout.write(DataHelper.getUTF8(s));
 		CMDout.write('\n');
 		CMDout.flush();
 	}
diff --git a/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java b/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java
index 8e1cebb735b701060ae4b5814c0a5b0e8eb923dc..11b4010292ad1e57e0eb46b1875eef74c426cfc2 100644
--- a/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java
+++ b/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java
@@ -21,6 +21,7 @@ import java.net.Socket;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import net.i2p.client.streaming.I2PSocket;
+import net.i2p.data.DataHelper;
 import net.i2p.util.I2PAppThread;
 
 /**
@@ -106,7 +107,7 @@ public class I2PtoTCP implements Runnable {
 
 					if (tell) {
 						// tell who is connecting
-						out.write(I2P.getPeerDestination().toBase64().getBytes());
+						out.write(DataHelper.getASCII(I2P.getPeerDestination().toBase64()));
 						out.write(10); // nl
 						out.flush(); // not really needed, but...
 					}
diff --git a/apps/admin/java/src/net/i2p/router/admin/AdminRunner.java b/apps/admin/java/src/net/i2p/router/admin/AdminRunner.java
index 2851d7d867b9d4e9f965c90289bcdb3b2fafdfca..d5c63c60d33e864c81a13d61f3feab242623df22 100644
--- a/apps/admin/java/src/net/i2p/router/admin/AdminRunner.java
+++ b/apps/admin/java/src/net/i2p/router/admin/AdminRunner.java
@@ -11,6 +11,7 @@ import java.util.Iterator;
 import java.util.Set;
 
 import net.i2p.data.Hash;
+import net.i2p.data.DataHelper
 import net.i2p.router.Router;
 import net.i2p.router.RouterContext;
 import net.i2p.util.I2PThread;
@@ -47,7 +48,7 @@ class AdminRunner implements Runnable {
             reply(out, "this is not a website");
         } else if ( (command.indexOf("routerStats.html") >= 0) || (command.indexOf("oldstats.jsp") >= 0) ) {
             try {
-                out.write("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n".getBytes());
+                out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n"));
                 _generator.generateStatsPage(new OutputStreamWriter(out));
                 out.close();
             } catch (IOException ioe) {
@@ -61,7 +62,7 @@ class AdminRunner implements Runnable {
             reply(out, shutdown(command));
         } else if (true || command.indexOf("routerConsole.html") > 0) {
             try {
-                out.write("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n".getBytes());
+                out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n"));
                 _context.router().renderStatusHTML(new OutputStreamWriter(out));
                 out.close();
             } catch (IOException ioe) {
@@ -80,7 +81,7 @@ class AdminRunner implements Runnable {
         reply.append("Content-type: text/html\n\n");
         reply.append(content);
         try {
-            out.write(reply.toString().getBytes());
+            out.write(DataHelper.getASCII(reply.toString()));
             out.close();
         } catch (IOException ioe) {
             if (_log.shouldLog(Log.WARN))
@@ -97,7 +98,7 @@ class AdminRunner implements Runnable {
         reply.append("Content-type: text/plain\n\n");
         reply.append(content);
         try {
-            out.write(reply.toString().getBytes());
+            out.write(DataHelper.getASCII(reply.toString()));
             out.close();
         } catch (IOException ioe) {
             if (_log.shouldLog(Log.WARN))
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java
index bb7a763feccd3ea53914fdf47ef9851da6a558e8..0f5b5dcce5df0937d66b187811d0dcd178605074 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java
@@ -240,7 +240,7 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
                         }
                         if (user != null && pw != null) {
                             newRequest.append("Proxy-Authorization: Basic ")
-                                      .append(Base64.encode((user + ':' + pw).getBytes(), true))    // true = use standard alphabet
+                                      .append(Base64.encode(DataHelper.getUTF8(user + ':' + pw), true))    // true = use standard alphabet
                                       .append("\r\n");
                         }
                     }
@@ -265,7 +265,7 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
                     else
                         _log.warn(getPrefix(requestId) + "Auth required, sending 407");
                 }
-                out.write(getAuthError(result == AuthResult.AUTH_STALE).getBytes());
+                out.write(DataHelper.getASCII(getAuthError(result == AuthResult.AUTH_STALE)));
                 s.close();
                 return;
             }
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java
index 2ae6abba466bc56057d7445858210e73d9b7cf80..157a94011dceae0212ea4ccd0d237e46bf73e1c9 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java
@@ -455,7 +455,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
             if (allowGZIP && useGZIP) {
                 t = new CompressedRequestor(s, socket, modifiedHeader, getTunnel().getContext(), _log);
             } else {
-                t = new I2PTunnelRunner(s, socket, slock, null, modifiedHeader.getBytes(),
+                t = new I2PTunnelRunner(s, socket, slock, null, DataHelper.getUTF8(modifiedHeader),
                                                null, (I2PTunnelRunner.FailCallback) null);
             }
             // run in the unlimited client pool
@@ -537,7 +537,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
                 
                 if (_log.shouldLog(Log.INFO))
                     _log.info("request headers: " + _headers);
-                serverout.write(_headers.getBytes());
+                serverout.write(DataHelper.getUTF8(_headers));
                 browserin = _browser.getInputStream();
                 // Don't spin off a thread for this except for POSTs
                 // beware interference with Shoutcast, etc.?
@@ -575,7 +575,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
                 Map<String, List<String>> headers = readHeaders(null, serverin, command,
                     SERVER_SKIPHEADERS, _ctx);
                 String modifiedHeaders = formatHeaders(headers, command);
-                compressedOut.write(modifiedHeaders.getBytes());
+                compressedOut.write(DataHelper.getUTF8(modifiedHeaders));
 
                 Sender s = new Sender(compressedOut, serverin, "server: server to browser", _log);
                 if (_log.shouldLog(Log.INFO))
@@ -702,7 +702,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
             //if (_log.shouldLog(Log.INFO))
             //    _log.info("Including x-i2p-gzip as the content encoding in the response");
             if (shouldCompress())
-                out.write("Content-encoding: x-i2p-gzip\r\n".getBytes());
+                out.write(DataHelper.getASCII("Content-encoding: x-i2p-gzip\r\n"));
             super.finishHeaders();
         }
 
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java
index 79d974e9061adafa84ea6a6c765dff56cb669f43..87dd7e937c2b1b5eeacf790239143f1b59283a0e 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelIRCServer.java
@@ -129,7 +129,7 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
             this.cloakKey = new byte[Hash.HASH_LENGTH];
             tunnel.getContext().random().nextBytes(this.cloakKey);
         } else {
-            this.cloakKey = SHA256Generator.getInstance().calculateHash(passphrase.trim().getBytes()).getData();
+            this.cloakKey = SHA256Generator.getInstance().calculateHash(DataHelper.getUTF8(passphrase.trim())).getData();
         }
         
         // get the fake hostmask to use
@@ -159,7 +159,7 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
                 modifiedRegistration = buf.toString();
             }
             Socket s = getSocket(socket.getPeerDestination().calculateHash(), socket.getLocalPort());
-            Thread t = new I2PTunnelRunner(s, socket, slock, null, modifiedRegistration.getBytes(),
+            Thread t = new I2PTunnelRunner(s, socket, slock, null, DataHelper.getUTF8(modifiedRegistration),
                                            null, (I2PTunnelRunner.FailCallback) null);
             // run in the unlimited client pool
             //t.start();
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSHeader.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSHeader.java
index 9b8a2c6f43aa410722f4bea3e9634bfcea1cf06c..6c61e09597702bab9e21a923d6b8533836b2a90f 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSHeader.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSHeader.java
@@ -55,7 +55,7 @@ public class SOCKSHeader {
         this.header = new byte[beg.length + 60 + end.length];
         System.arraycopy(this.header, 0, beg, 0, beg.length);
         String b32 = dest.toBase32();
-        System.arraycopy(this.header, beg.length, b32.getBytes(), 0, 60);
+        System.arraycopy(this.header, beg.length, DataHelper.getASCII(b32), 0, 60);
         System.arraycopy(this.header, beg.length + 60, end, 0, end.length);
     }
     
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSServerFactory.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSServerFactory.java
index 1c348e1f4b0bb389d41b7f0bf908f3a0ed3ae925..049d190b652b6d4890946ffdfc252f5e61bc0c36 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSServerFactory.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSServerFactory.java
@@ -12,6 +12,7 @@ import java.io.IOException;
 import java.net.Socket;
 import java.util.Properties;
 
+import net.i2p.data.DataHelper;
 import net.i2p.i2ptunnel.I2PTunnelHTTPClientBase;
 
 /**
@@ -63,7 +64,7 @@ public class SOCKSServerFactory {
             case 'H':
             case 'P':
                 DataOutputStream out = new DataOutputStream(s.getOutputStream());
-                out.write(ERR_REQUEST_DENIED.getBytes());
+                out.write(DataHelper.getASCII(ERR_REQUEST_DENIED));
                 throw new SOCKSException("HTTP request to socks");
             default:
                 throw new SOCKSException("SOCKS protocol version not supported (" + Integer.toHexString(socksVer) + ")");
diff --git a/apps/ministreaming/java/demo/net/i2p/client/streaming/StreamSinkServer.java b/apps/ministreaming/java/demo/net/i2p/client/streaming/StreamSinkServer.java
index c72313623d52dfc8cf64881797e560e3322d0ff8..64cc7d9ebf0caac723f49a9d16e41c678b4906c9 100644
--- a/apps/ministreaming/java/demo/net/i2p/client/streaming/StreamSinkServer.java
+++ b/apps/ministreaming/java/demo/net/i2p/client/streaming/StreamSinkServer.java
@@ -11,6 +11,7 @@ import java.util.Properties;
 import net.i2p.I2PAppContext;
 import net.i2p.I2PException;
 import net.i2p.data.DataFormatException;
+import net.i2p.data.DataHelper;
 import net.i2p.data.Destination;
 import net.i2p.util.I2PThread;
 import net.i2p.util.Log;
@@ -141,7 +142,7 @@ public class StreamSinkServer {
                     if (_log.shouldLog(Log.DEBUG))
                         _log.debug("read and wrote " + read + " (" + written + ")");
                 }
-                fos.write(("written: [" + written + "]\n").getBytes());
+                fos.write((DataHelper.getUTF8("written: [" + written + "]\n")));
                 long lifetime = System.currentTimeMillis() - start;
                 _log.info("Got EOF from client socket [written=" + written + " lifetime=" + lifetime + "]");
             } catch (IOException ioe) {
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigAdvancedHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigAdvancedHandler.java
index c098ee1476491dce155152ce72ef2f496eec5a4a..f1d621674f19ac9e57d1d13f2ca10fa045033be6 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigAdvancedHandler.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigAdvancedHandler.java
@@ -55,7 +55,7 @@ public class ConfigAdvancedHandler extends FormHandler {
         if (_config != null) {
             Properties props = new Properties();
             try {
-                DataHelper.loadProps(props, new ByteArrayInputStream(_config.getBytes()));
+                DataHelper.loadProps(props, new ByteArrayInputStream(DataHelper.getUTF8(_config)));
             } catch (IOException ioe) {
                 _log.error("Config error", ioe);
                 addFormError(ioe.toString());
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHandler.java
index 5c65011a091c94fa1a2483154bda8daada34a24a..f574ab85aab36405433aea5d645250fe2f37b46f 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHandler.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHandler.java
@@ -4,6 +4,7 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.util.Properties;
 
+import net.i2p.data.DataHelper;
 import net.i2p.util.LogManager;
 
 /**
@@ -76,7 +77,7 @@ public class ConfigLoggingHandler extends FormHandler {
             try {
                 Properties props = new Properties();
                 if (_levels != null)
-                    props.load(new ByteArrayInputStream(_levels.getBytes()));
+                    props.load(new ByteArrayInputStream(DataHelper.getUTF8(_levels)));
                 if (_newLogClass != null)
                     props.setProperty(_newLogClass, _newLogLevel);
                 _context.logManager().setLimits(props);
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java b/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java
index b55283b4cc559af7b5898c0b9746f5df5b5646f5..edcc3273331759e17c7a5aff9738445ecb3c9199 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java
@@ -11,6 +11,7 @@ import java.util.StringTokenizer;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Semaphore;
 
+import net.i2p.data.DataHelper;
 import net.i2p.router.RouterContext;
 import net.i2p.stat.Rate;
 import net.i2p.stat.RateStat;
@@ -259,8 +260,8 @@ public class StatSummarizer implements Runnable {
         for (SummaryListener lsnr : _listeners) {
             if (lsnr.getRate().equals(rate)) {
                 lsnr.getData().exportXml(out);
-                out.write(("<!-- Rate: " + lsnr.getRate().getRateStat().getName() + " for period " + lsnr.getRate().getPeriod() + " -->\n").getBytes());
-                out.write(("<!-- Average data source name: " + lsnr.getName() + " event count data source name: " + lsnr.getEventName() + " -->\n").getBytes());
+                out.write(DataHelper.getUTF8("<!-- Rate: " + lsnr.getRate().getRateStat().getName() + " for period " + lsnr.getRate().getPeriod() + " -->\n"));
+                out.write(DataHelper.getUTF8("<!-- Average data source name: " + lsnr.getName() + " event count data source name: " + lsnr.getEventName() + " -->\n"));
                 return true;
             }
         }
diff --git a/apps/sam/java/test/net/i2p/sam/TestCreateSessionDatagram.java b/apps/sam/java/test/net/i2p/sam/TestCreateSessionDatagram.java
index 80772755e3a24f0870852b7666195d14678fbfca..612a0424d3d6d5dac4ed7896e00462dbf2227264 100644
--- a/apps/sam/java/test/net/i2p/sam/TestCreateSessionDatagram.java
+++ b/apps/sam/java/test/net/i2p/sam/TestCreateSessionDatagram.java
@@ -40,12 +40,12 @@ public class TestCreateSessionDatagram {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.debug("line read for valid version: " + line);
             String req = "SESSION CREATE STYLE=DATAGRAM DESTINATION=" + destName + " " + conOptions + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.info("Response to creating the session with destination " + destName + ": " + line);
             _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
diff --git a/apps/sam/java/test/net/i2p/sam/TestCreateSessionRaw.java b/apps/sam/java/test/net/i2p/sam/TestCreateSessionRaw.java
index 246ca615d14686377a019955b89d86064c71dda6..7ce07162318d580edd17ac6822ddf009eb2b590b 100644
--- a/apps/sam/java/test/net/i2p/sam/TestCreateSessionRaw.java
+++ b/apps/sam/java/test/net/i2p/sam/TestCreateSessionRaw.java
@@ -56,12 +56,12 @@ public class TestCreateSessionRaw {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             //_log.debug("line read for valid version: " + line);
             String req = "SESSION CREATE STYLE=RAW DESTINATION=" + destName + " " + conOptions + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.info("Response to creating the session with destination " + destName + ": " + line);
             _log.debug("The above should contain SESSION STATUS RESULT=OK");
diff --git a/apps/sam/java/test/net/i2p/sam/TestCreateSessionStream.java b/apps/sam/java/test/net/i2p/sam/TestCreateSessionStream.java
index 13a16a932ce9e236ed6d9351c1619848f02e81ba..fa533f9fed51aabe2c4d9a48fc59fb2bc99a73d2 100644
--- a/apps/sam/java/test/net/i2p/sam/TestCreateSessionStream.java
+++ b/apps/sam/java/test/net/i2p/sam/TestCreateSessionStream.java
@@ -5,6 +5,7 @@ import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.Socket;
 
+import net.i2p.data.DataHelper;
 import net.i2p.util.Log;
 
 public class TestCreateSessionStream {
@@ -40,12 +41,12 @@ public class TestCreateSessionStream {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.debug("line read for valid version: " + line);
             String req = "SESSION CREATE STYLE=STREAM DESTINATION=" + destName + " " + conOptions + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.info("Response to creating the session with destination " + destName + ": " + line);
             _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
diff --git a/apps/sam/java/test/net/i2p/sam/TestDatagramTransfer.java b/apps/sam/java/test/net/i2p/sam/TestDatagramTransfer.java
index 845093bfc79b996ae2d24c1f0d942206feeca61c..52c0e2a105282718edf29aab38f15bc32bc17642 100644
--- a/apps/sam/java/test/net/i2p/sam/TestDatagramTransfer.java
+++ b/apps/sam/java/test/net/i2p/sam/TestDatagramTransfer.java
@@ -7,6 +7,7 @@ import java.net.Socket;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
+import net.i2p.data.DataHelper;
 import net.i2p.util.Log;
 
 public class TestDatagramTransfer {
@@ -22,17 +23,17 @@ public class TestDatagramTransfer {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.debug("line read for valid version: " + line);
             String req = "SESSION CREATE STYLE=DATAGRAM DESTINATION=" + destName + " " + conOptions + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.info("Response to creating the session with destination " + destName + ": " + line);
             _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
             String lookup = "NAMING LOOKUP NAME=ME\n";
-            out.write(lookup.getBytes());
+            out.write(DataHelper.getASCII(lookup));
             line = reader.readLine();
             _log.info("Response from the lookup for ME: " + line);
             _log.debug("The above should be a NAMING REPLY");
@@ -50,7 +51,7 @@ public class TestDatagramTransfer {
             }
             
             String send = "DATAGRAM SEND DESTINATION=" + value + " SIZE=3\nYo!";
-            out.write(send.getBytes());
+            out.write(DataHelper.getASCII(send));
             line = reader.readLine();
             tok = new StringTokenizer(line);
             maj = tok.nextToken();
diff --git a/apps/sam/java/test/net/i2p/sam/TestDest.java b/apps/sam/java/test/net/i2p/sam/TestDest.java
index f5d8cdff467ece67ec2db2a9374474653643f2d5..2662b583549530310c262ce564bf2cd65c4a1784 100644
--- a/apps/sam/java/test/net/i2p/sam/TestDest.java
+++ b/apps/sam/java/test/net/i2p/sam/TestDest.java
@@ -19,17 +19,17 @@ public class TestDest {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.debug("line read for valid version: " + line);
             String req = "SESSION CREATE STYLE=STREAM DESTINATION=testNaming " + conOptions + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.debug("Response to creating the session with destination testNaming: " + line);
             _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
             String lookup = "DEST GENERATE\n";
-            out.write(lookup.getBytes());
+            out.write(DataHelper.getASCII(lookup));
             line = reader.readLine();
             _log.info("Response from the dest generate: " + line);
             _log.debug("The abouve should be a DEST REPLY");
diff --git a/apps/sam/java/test/net/i2p/sam/TestHello.java b/apps/sam/java/test/net/i2p/sam/TestHello.java
index d2e1da68ffa73e708977905e5ac1a811e8c69347..df1b36330b3bd908fc74a119637e923971d2b792 100644
--- a/apps/sam/java/test/net/i2p/sam/TestHello.java
+++ b/apps/sam/java/test/net/i2p/sam/TestHello.java
@@ -5,6 +5,7 @@ import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.Socket;
 
+import net.i2p.data.DataHelper;
 import net.i2p.util.Log;
 
 public class TestHello {
@@ -21,7 +22,7 @@ public class TestHello {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.info("line read for valid version: " + line);
@@ -36,7 +37,7 @@ public class TestHello {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=9.0 MAX=8.3\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=9.0 MAX=8.3\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.info("line read for invalid version: " + line);
@@ -51,7 +52,7 @@ public class TestHello {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO h0 h0 h0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO h0 h0 h0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.info("line read for valid version: " + line);
diff --git a/apps/sam/java/test/net/i2p/sam/TestNaming.java b/apps/sam/java/test/net/i2p/sam/TestNaming.java
index 61c0364c361a23e0912e1c70034b3aa94480171f..a926b828b04c2f26d5436a3b8cb8524e3b7b9613 100644
--- a/apps/sam/java/test/net/i2p/sam/TestNaming.java
+++ b/apps/sam/java/test/net/i2p/sam/TestNaming.java
@@ -39,17 +39,17 @@ public class TestNaming {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.debug("line read for valid version: " + line);
             String req = "SESSION CREATE STYLE=STREAM DESTINATION=testNaming " + conOptions + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.debug("Response to creating the session with destination testNaming: " + line);
             _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
             String lookup = "NAMING LOOKUP NAME=" + name + "\n";
-            out.write(lookup.getBytes());
+            out.write(DataHelper.getASCII(lookup));
             line = reader.readLine();
             _log.info("Response from the lookup for [" + name +"]: " + line);
             _log.debug("The abouve should be a NAMING REPLY");
diff --git a/apps/sam/java/test/net/i2p/sam/TestRawTransfer.java b/apps/sam/java/test/net/i2p/sam/TestRawTransfer.java
index 3e9a7692432089d4cd3ccaac6ad60a02cc921d0d..584a7fb787f42f67254fdf9924b17348ba8943f5 100644
--- a/apps/sam/java/test/net/i2p/sam/TestRawTransfer.java
+++ b/apps/sam/java/test/net/i2p/sam/TestRawTransfer.java
@@ -22,17 +22,17 @@ public class TestRawTransfer {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.debug("line read for valid version: " + line);
             String req = "SESSION CREATE STYLE=RAW DESTINATION=" + destName + " " + conOptions + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.info("Response to creating the session with destination " + destName + ": " + line);
             _log.debug("The above should contain SESSION STATUS RESULT=OK\n\n\n");
             String lookup = "NAMING LOOKUP NAME=ME\n";
-            out.write(lookup.getBytes());
+            out.write(DataHelper.getASCII(lookup));
             line = reader.readLine();
             _log.info("Response from the lookup for ME: " + line);
             _log.debug("The above should be a NAMING REPLY");
@@ -50,7 +50,7 @@ public class TestRawTransfer {
             }
             
             String send = "RAW SEND DESTINATION=" + value + " SIZE=3\nYo!";
-            out.write(send.getBytes());
+            out.write(DataHelper.getASCII(send));
             line = reader.readLine();
             try {
                 tok = new StringTokenizer(line);
diff --git a/apps/sam/java/test/net/i2p/sam/TestStreamTransfer.java b/apps/sam/java/test/net/i2p/sam/TestStreamTransfer.java
index 2ebb09afc840505316457e04100bc845c10406ad..70188d2d2d5457ac1f752bff9dc22984e66e36bd 100644
--- a/apps/sam/java/test/net/i2p/sam/TestStreamTransfer.java
+++ b/apps/sam/java/test/net/i2p/sam/TestStreamTransfer.java
@@ -11,6 +11,7 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
+import net.i2p.data.DataHelper;
 import net.i2p.util.I2PThread;
 import net.i2p.util.Log;
 
@@ -62,17 +63,17 @@ public class TestStreamTransfer {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.debug("line read for valid version: " + line);
             String req = "SESSION CREATE STYLE=STREAM DESTINATION=Alice " + conOptions + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.info("Response to creating the session with destination Alice: " + line);
             
             req = "NAMING LOOKUP NAME=ME\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             StringTokenizer tok = new StringTokenizer(line);
             String maj = tok.nextToken();
@@ -212,16 +213,16 @@ public class TestStreamTransfer {
         try {
             Socket s = new Socket(host, port);
             OutputStream out = s.getOutputStream();
-            out.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+            out.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
             BufferedReader reader = new BufferedReader(new InputStreamReader(s.getInputStream()));
             String line = reader.readLine();
             _log.debug("line read for valid version: " + line);
             String req = "SESSION CREATE STYLE=STREAM DESTINATION=" + sessionName + " " + conOptions + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.info("Response to creating the session with destination "+ sessionName+": " + line);
             req = "STREAM CONNECT ID=42 DESTINATION=" + _alice + "\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             line = reader.readLine();
             _log.info("Response to the stream connect from "+sessionName+" to Alice: " + line);
             StringTokenizer tok = new StringTokenizer(line);
@@ -238,18 +239,18 @@ public class TestStreamTransfer {
             try { Thread.sleep(5*1000) ; } catch (InterruptedException ie) {}
             req = "STREAM SEND ID=42 SIZE=10\nBlahBlah!!";
             _log.info("\n** Sending BlahBlah!!");
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             out.flush();
             try { Thread.sleep(5*1000) ; } catch (InterruptedException ie) {}
             req = "STREAM SEND ID=42 SIZE=10\nFooBarBaz!";
             _log.info("\n** Sending FooBarBaz!");
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             out.flush();
             /* Don't delay here, so we can test whether all data is
                sent even if we do a STREAM CLOSE immediately. */
             _log.info("Sending close");
             req = "STREAM CLOSE ID=42\n";
-            out.write(req.getBytes());
+            out.write(DataHelper.getASCII(req));
             out.flush();
             synchronized (_counterLock) {
                 _closeCounter++;
diff --git a/apps/sam/java/test/net/i2p/sam/TestSwarm.java b/apps/sam/java/test/net/i2p/sam/TestSwarm.java
index 01f5a22a5b6c90cea82c9d04e224908a9416e402..8d96ed2f5966222a23a299988ae3c571791f2bfb 100644
--- a/apps/sam/java/test/net/i2p/sam/TestSwarm.java
+++ b/apps/sam/java/test/net/i2p/sam/TestSwarm.java
@@ -140,7 +140,7 @@ public class TestSwarm {
     private String handshake() {
         synchronized (_samOut) {
             try {
-                _samOut.write("HELLO VERSION MIN=1.0 MAX=1.0\n".getBytes());
+                _samOut.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n"));
                 _samOut.flush();
                 _log.debug("Hello sent");
                 boolean ok = _eventHandler.waitForHelloReply();
@@ -148,14 +148,14 @@ public class TestSwarm {
                 if (!ok) 
                     throw new IOException("wtf, hello failed?");
                 String req = "SESSION CREATE STYLE=STREAM DESTINATION=" + _destFile + " " + _conOptions + "\n";
-                _samOut.write(req.getBytes());
+                _samOut.write(DataHelper.getUTF8(req));
                 _samOut.flush();
                 _log.debug("Session create sent");
                 ok = _eventHandler.waitForSessionCreateReply();
                 _log.debug("Session create reply found: " + ok);
 
                 req = "NAMING LOOKUP NAME=ME\n";
-                _samOut.write(req.getBytes());
+                _samOut.write(DataHelper.getASCII(req));
                 _samOut.flush();
                 _log.debug("Naming lookup sent");
                 String destination = _eventHandler.waitForNamingReply("ME");
@@ -177,7 +177,7 @@ public class TestSwarm {
     private boolean writeDest(String dest) {
         try {
             FileOutputStream fos = new FileOutputStream(_destFile);
-            fos.write(dest.getBytes());
+            fos.write(DataHelper.getASCII(dest));
             fos.close();
             return true;
         } catch (Exception e) {
@@ -203,7 +203,7 @@ public class TestSwarm {
                         _remotePeers.put(new Integer(con), flooder);
                     }
                     
-                    byte msg[] = ("STREAM CONNECT ID=" + con + " DESTINATION=" + remDest + "\n").getBytes();
+                    byte msg[] = (DataHelper.getUTF8("STREAM CONNECT ID=" + con + " DESTINATION=" + remDest + "\n"));
                     synchronized (_samOut) {
                         _samOut.write(msg);
                         _samOut.flush();
@@ -257,7 +257,7 @@ public class TestSwarm {
             long value = 0;
             long lastSend = _context.clock().now();
             while (!_closed) {
-                byte msg[] = ("STREAM SEND ID=" + _connectionId + " SIZE=" + data.length + "\n").getBytes();
+                byte msg[] = (DataHelper.getASCII("STREAM SEND ID=" + _connectionId + " SIZE=" + data.length + "\n"));
                 DataHelper.toLong(data, 0, 4, value);
                 try {
                     synchronized (_samOut) {
diff --git a/apps/streaming/java/test/junit/net/i2p/client/streaming/impl/EchoIT.java b/apps/streaming/java/test/junit/net/i2p/client/streaming/impl/EchoIT.java
index a8496392bc5ba26bda3d1803cbffab2f583e3a46..bce89bf4a24e7927ca12e70010f22ee849f53ca6 100644
--- a/apps/streaming/java/test/junit/net/i2p/client/streaming/impl/EchoIT.java
+++ b/apps/streaming/java/test/junit/net/i2p/client/streaming/impl/EchoIT.java
@@ -12,6 +12,7 @@ import net.i2p.client.I2PSession;
 import net.i2p.client.streaming.I2PSocket;
 import net.i2p.client.streaming.I2PServerSocket;
 import net.i2p.client.streaming.I2PSocketManager;
+import net.i2p.data.DataHelper;
 import net.i2p.util.Log;
 
 /**
@@ -116,7 +117,7 @@ public class EchoIT extends StreamingITBase {
                 InputStream in = socket.getInputStream();
                 OutputStream out = socket.getOutputStream();
                 for (int i = 0; i < 3; i++) {
-                    out.write("blah!".getBytes());
+                    out.write(DataHelper.getASCII("blah!"));
                     _log.debug("client wrote a line");
                     out.flush();
                     _log.debug("client flushed");