@Override
    public byte[] encodeValue(final AbstractFieldType abstractFieldType, final Object value, final ByteOrder byteOrder) throws ImagingException {
        if (!(value instanceof String)) {
            throw new ImagingException("Text value not String", value);
        }
        final String s = (String) value;
        final byte[] bytes = s.getBytes(StandardCharsets.UTF_16LE);
        return Arrays.copyOf(bytes, bytes.length + 2);
    }
Windows XP onwards store some tags using UTF-16LE, but the field type is byte - here we deal with this.
src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java