Skip to content

spring.ftl does not support turning off escaping for some macros on Spring 5 [SPR-16951] #21489

@spring-projects-issues

Description

@spring-projects-issues

Kaj Hejer opened SPR-16951 and commented

After updating to Spring 5 all output from Spring freemarker macros are escaped. In <@spring.message> the message is escaped and in <@spring.formRadioButtons> the separator attribute is escaped f.x. "<br/>".

This has been discussed at https://stackoverflow.com/questions/50871832/spring-5-and-escaping-in-springs-freemarker-macros

Config:

@Bean
public FreeMarkerConfigurer freeMarkerConfigurer() {
    FreeMarkerConfigurer config = new FreeMarkerConfigurer();
    config.setTemplateLoaderPath("/WEB-INF/templates/ftl/");    
    Properties props = new Properties();
    props.put("template_update_delay", getFreemarkerUpdateDelay());
    props.put("template_exception_handler", getFreemarkerExceptionHandler());
    props.put("url_escaping_charset", WebConstants.CHAR_SET_UTF_8);
    config.setFreemarkerSettings(props);
    config.setDefaultEncoding(WebConstants.CHAR_SET_UTF_8);
    return config;
}

We use Freemarker 2.3.28 and Spring 5.0.7.RELEASE


Affects: 5.0.7

Issue Links:

Referenced from: commits 08e1c8c, 75f26ee

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions