title: Java modified UTF-8 strings in Python
body: <p>I am interfacing with a Java application via Python. I need to be able to construct byte sequences which contain UTF-8 strings. Java uses a modified UTF-8 encoding in <code>DataInputStream.readUTF()</code> which is not supported by Python (<a href="http://bugs.python.org/issue2857" rel="nofollow noreferrer">yet at least</a>)</p>
  
  <p>Can anybody point me in the right direction to construct Java modified UTF-8 strings in Python?</p>
  
  <p>Update #1: To see a little more about the Java modified UTF-8, check out the <code>readUTF()</code> method from the DataInput interface on line 550 <a href="http://www.docjar.com/html/api/java/io/DataInput.java.html" rel="nofollow noreferrer">here</a>, or <a href="https://docs.oracle.com/javase/7/docs/api/java/io/DataInput.html" rel="nofollow noreferrer">here in the Java SE docs</a>.</p>
  
  <p>Update #2: I am trying to interface with a third-party JBoss web app which is using this modified UTF-8 format to read in strings via POST requests by calling <code>DataInputStream.readUTF()</code> (sorry for any confusion regarding normal Java UTF-8 string operation).</p>