title: why String got appended with un-printable characters
body: <p>I want to obtain ip address by using this following classes, and accidentally found out that the <code>ipAddress</code> from the following code sometimes contains un-printable characters such as <code>DC2</code>, <code>CAN</code>...I would like to see if you know what cause this result and how to prevent this? Having this up-printable char makes the string unpredictable and hard to do post-processing. Can anyone please share some experience to me?  </p>
  
  <pre><code>import java.net.Inet6Address;
  import java.net.InetAddress;
  import java.net.UnknownHostException;
  
  for (Enumeration&lt;NetworkInterface&gt; en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
              NetworkInterface intf = en.nextElement();
              for (Enumeration&lt;InetAddress&gt; enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
                  InetAddress inetAddress = enumIpAddr.nextElement();
  
                      String ipAddress = inetAddress.getHostAddress();
  
  //this ipAddress contains some up-printable char..
  
              }
          } 
  </code></pre>
  
  <p>The <code>ipAddress</code> string is store in arrayList then send out to my server(in JsonArray). On server side, there is nothing magical, I only read the String from ArrayList then those special characters appears there.</p>
  
  <pre><code>s = JsonArray.getString(i);
  </code></pre>
  
  <p>All i can think about is....maybe the package sent from client got contaminated. What do you say? </p>
  
  <p>I know a easy way to handle this is to remove the char <code>DC2</code> and <code>CAN</code>appended behind the string, however, i would like to see what cause this and all the possibility. Thanks. </p>