1

{capture assign=last_name}{contact.last_name}{/capture}{$last_name|upper}

I'm trying to render my contact name in uppercases with Smarty and include letters with accents.

At the bottom of this page in the the Smarty doc: https://www.smarty.net/docs/en/language.modifier.upper.tpl It is advised to use {$your_variable|@strtoupper} but {capture assign=last_name}{contact.last_name}{/capture}{$last_name|@strtoupper} doesn't work

2 Answers 2

3

You probably want mb_strtoupper. Smarty's |upper just does strtoupper - you can see this if you look in packages/smarty/plugins/modifier.upper.php.

So one way is to hack modifier.upper.php and change it to use mb_strtoupper. You can also try using {$last_name|@mb_strtoupper} but it might give you a security error.

3
0

As Demerit pointed in this comment: https://civicrm.stackexchange.com/a/39969/104

|crmupper is the expected modifier to be used. Internally it ends up using the mb_stroupper function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.