LazyProcessingCharSequence and Unicode characters

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

LazyProcessingCharSequence and Unicode characters

paranoiabla
Hello,
I'm using thymeleaf to parse some static content like this:

        CmsPageEntityDefinition contentPage = new com.nemesis.platform.module.cms.core.entity.CmsPageEntity();
        contentPage.setDescription(Locale.ENGLISH, "my description");
        contentPage.setDescription(new Locale("bg"), "описание на български");

        params.put("page", contentPage);
        params.put("bgLocale", new Locale("bg"));

        assertEquals("Buy more than \"USD10.00\" worth of products to get 3 of \"my description\" FREE!", provider.parseContent(
                        "Buy more than [[ ${ currency != null ?  \"XXX\" : currencyFormatter.print(activeSubtotalThreshold, bgLocale) }]] worth of products to get [[${quantity}]] of [[${page.getDescription(bgLocale)}]] FREE!",
                        params));

by having a custom provider. When I run this test it fails because of:

[ERROR] Failures:
[ERROR]   ThymeleafContentProviderIntegrationTest.testParseInlineContent:169 expected:<...n>Buy more than "USD[10.00" worth of products to get 3 of "my description]" FREE!> but was:<...n>Buy more than "USD[ 10,00" worth of products to get 3 of "\u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u043D\u0430 \u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438]" FREE!>

I tried to debug it and from what I can tell you are creating the LazyProcessingCharSequence which is a CharSequence and the characters in there are screwed. For some reason I can't really debug how the value of the CharSequence is formed and I can see it is given to StandardInliningTextProcessor already messed-up. I was hoping someone of you would confirm if this is a bug or if there was a way to specify the charset of the LazyProcessingCharSequence.