[keycloak-user] Recommended practice for utf-8 messages resources

Federico Navarro Polo - Info.nl federico at info.nl
Tue May 22 07:56:41 EDT 2018


Hello,

I noticed there was an upgrade of freemarker templates and a few text resources changed to start using the function “?no_esc”

However, there are still text resources in the messages properties files that would need escaping.

Eg:
In keycloak/themes/src/main/resources-community/theme/base/login/messages/messages_nl.properties

linkIdpMessage=U moet uw e-mailadres verifiëren om uw account te koppelen aan {0}.

This text resource is passed to the template as a message, which is used in template.ftl:

<#if displayMessage && message?has_content>
    <div class="${properties.kcFeedbackAreaClass!}">
        <div class="alert alert-${message.type}">
            <#if message.type = 'success'><span class="${properties.kcFeedbackSuccessIcon!}"></span></#if>
            <#if message.type = 'warning'><span class="${properties.kcFeedbackWarningIcon!}"></span></#if>
            <#if message.type = 'error'><span class="${properties.kcFeedbackErrorIcon!}"></span></#if>
            <#if message.type = 'info'><span class="${properties.kcFeedbackInfoIcon!}"></span></#if>
            <span class="kc-feedback-text">${message.summary?no_esc}</span>
        </div>
    </div>
</#if>

The result is that the character ë is not escaped, but displayed as below:
U moet uw e-mailadres verifiëren om uw account te koppelen aan Facebook.

I understand there might be reasons to use ?no_esc on the message summary, so my question would be, what’s the recommended approach for those resource files. Should be everything html?



Met vriendelijke groet,

Federico Navarro

backend developer

federico at info.nl<mailto:federico at info.nl>  |  LinkedIn<https://www.linkedin.com/company/info-nl>  |  -<tel:+31205309161>

info.nl<http://www.info.nl/>

Sint Antoniesbreestraat 16  |  1011 HB Amsterdam  |  +31 (0)20 530 9100<tel:+31205309100>




More information about the keycloak-user mailing list