-
Notifications
You must be signed in to change notification settings - Fork 41.7k
Use Charset instead of String for Mustache template encoding #48347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Use Charset instead of String for Mustache template encoding #48347
Conversation
The MustacheResourceTemplateLoader previously defined the template encoding as a String, defaulting to "UTF-8". This change replaces the field with a Charset and initializes it with StandardCharsets.UTF_8. Using Charset improves type safety and aligns with modern Spring Boot standards, while avoiding implicit charset lookup issues. Signed-off-by: djlee <ddongjunn@gmail.com>
|
This would be a breaking change since |
This comment was marked as outdated.
This comment was marked as outdated.
Add setCharset(Charset) overload to MustacheResourceTemplateLoader while keeping setCharset(String) for backward compatibility. The String-based method is deprecated in favor of the Charset variant. Also deprecate MustacheProperties.getCharsetName() as it's primarily used with the deprecated setCharset(String) method. This change maintains backward compatibility while providing a more type-safe API that aligns with modern Java standards. See spring-projectsgh-48347 Signed-off-by: djlee <ddongjunn@gmail.com>
|
@philwebb Thanks for the feedback! I’ve updated the PR to add the setCharset(Charset) overload while keeping the existing String-based method for backward compatibility (now deprecated). This keeps the change backward compatible while providing a more type-safe API. Let me know if you’d like any further adjustments. |
The MustacheResourceTemplateLoader previously defined the template encoding as a String, defaulting to "UTF-8". This change replaces the field with a Charset and initializes it with StandardCharsets.UTF_8. Using Charset improves type safety and aligns with modern Spring Boot standards, while avoiding implicit charset lookup issues. See spring-projectsgh-48347 Signed-off-by: djlee <ddongjunn@gmail.com>
This replaces the use of charset name for our Mustache support. See spring-projectsgh-48347
|
This PR is ready to be merged once @ddongjunn thanks for the PR. To be consistent more work was required, see snicoll@65cd92f. When something is deprecated, our code base should not call it anymore. Then searching for the same pattern in the rest of the module for consistency revealed a number of other usages not covered initially. It's all done now and will be merged once we can. |
|
@snicoll Thanks for reviewing and refining the PR. |
| /** | ||
| * Set the charset. | ||
| * @param charSet the charset | ||
| * @deprecated since 4.1.0 in favor of {@link #setCharset(Charset)} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
The MustacheResourceTemplateLoader previously defined the template encoding as a String, defaulting to "UTF-8". This change replaces the field with a Charset and initializes it with StandardCharsets.UTF_8.
Using Charset improves type safety and aligns with modern Spring Boot standards, while avoiding implicit charset lookup issues.