[ 
https://issues.apache.org/jira/browse/FREEMARKER-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17568888#comment-17568888
 ] 

Florian Motteau commented on FREEMARKER-208:
--------------------------------------------

Thank you for the feedback. I totally agree on the fact that formatting things 
for humans or machines should be an explicit choice (and on the Locale.ROOT). 
Hopefully I will have some time to work on the solution you described.

> Allow to provide a specific locale for lower_case / upper_case
> --------------------------------------------------------------
>
>                 Key: FREEMARKER-208
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-208
>             Project: Apache Freemarker
>          Issue Type: Improvement
>            Reporter: Florian Motteau
>            Priority: Minor
>
> lower_case and upper_case filters rely on toLowerCase / toUpperCase methods. 
> They use the current environment locale as first and only parameter for these 
> methods.
> [https://github.com/apache/freemarker/blob/201533eb7c15e3cfc55b38da37f730a3492bec0f/src/main/java/freemarker/core/BuiltInsForStringsBasic.java#L433]
> In rare cases, we might want to provide a specific/fixed locale, to avoid 
> some weird problems, such as the Turkish/Azeri dotless i problem :
> {code:java}
> // lowercasing an uppercase i, using turkish locale
> System.out.println("I".toLowerCase(new Locale("tr", "TR")));{code}
> ...will output "ı" (which is a dotless "i").
> We faced this problem in OFBiz 
> (https://issues.apache.org/jira/browse/OFBIZ-12660), and although we can fix 
> this for our specific use case, it may be a good idea to be able to pass a 
> locale (which sould defaults to the environment locale if not provided) as 
> parameter for lower_case and upper_case :
> {code:java}
> myVar?lower_case("en", "EN") {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to