Fixes for UTF-8 problems writing strings across Java bindings