-
Notifications
You must be signed in to change notification settings - Fork 38
Description
When POJOs with String fields containing unicode chars are put into the cache using generated marshaller - the encoding breaks, loosing unicode chars.
It seem to be related to optimization in createLambdaHelper.
package org.infinispan.protostream.impl;
import java.nio.charset.StandardCharsets;
public class TestProtostream {
public static void main(String[] args) {
String test = "Hélló, Prótóstréám!";
// org.infinispan.protostream.impl.StringUtil.createLambdaHelper behaviour
// Hélló, Prótóstréám! -> H�ll�, Pr�t�str��m!
{
StringUtil.Utf8Helper utf8Helper = StringUtil.UTF8_HELPER;
byte[] encoded = utf8Helper.getBytes(test);
String decoded = new String(encoded, StandardCharsets.UTF_8);
System.out.println(test + " -> " + decoded);
}
// expected behaviour
// Hélló, Prótóstréám! -> Hélló, Prótóstréám!
{
byte[] encoded = test.getBytes(StandardCharsets.UTF_8);
String decoded = new String(encoded, StandardCharsets.UTF_8);
System.out.println(test + " -> " + decoded);
}
}
}
Reactions are currently unavailable