Description
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
charset
of the output, since it writes the output to ajava.io.Writer
. Since theWriter
is made by the software that encapsulates FreeMarker (such as a Web application framework), the outputcharset
is 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 thecharset
that theWriter
uses), to inform FreeMarker whatcharset
is used for the output (otherwise FreeMarker can't find it out). Some features, such as theurl
built-in, and theoutput_encoding
special variable utilize this information. Thus, if the enclosing software doesn't set this setting then FreeMarker features that need to know the outputcharset
can't be used.