Skip to content

Force Java string conversion to UTF8

Todd requested to merge todoooo/vtk:Fix_Java_wrappers_for_UTF8 into master

Java uses its Charset.defaultCharset() setting for converting a string to bytes. On Mac/Linux the character set defaults to UTF-8 but on Windows it depends on the locale setting. So the behaviour of String.getBytes() is inconsistent unless the encoding format is specified in the method parameter. See https://discourse.vtk.org/t/windows-rendering-issues/2542/13

In order to render text/captions/labels correctly in VTK all java strings must be converted to UTF-8 byte arrays. This fix also ensures file names and paths are converted properly by the Java wrappers.

@ben.boeckel Please review.

Backport: release

Edited by Ben Boeckel

Merge request reports