Overview
While researching #33071, I discovered that Spring's FreeMarkerView implementations should be configuring the output_encoding for template rendering.
Specifically, The charset for output section of the FreeMarker documentation states the following (bold emphasis added by me).
In principle FreeMarker does not deal with the
charsetof the output, since it writes the output to ajava.io.Writer. Since theWriteris made by the software that encapsulates FreeMarker (such as a Web application framework), the outputcharsetis controlled by the encapsulating software. Still, FreeMarker has a setting calledoutput_encoding(starting from FreeMarker version 2.3.1). The enclosing software should set this setting (to thecharsetthat theWriteruses), to inform FreeMarker whatcharsetis used for the output (otherwise FreeMarker can't find it out). Some features, such as theurlbuilt-in, and theoutput_encodingspecial variable utilize this information. Thus, if the enclosing software doesn't set this setting then FreeMarker features that need to know the outputcharsetcan't be used.
Related Issues
-
33071