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
Maybe this can help you, although it looks like it's the reverse of what you're doing:
Connecting a Java applet to a python SocketServer