We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Volt "upper" modifier doesn't work with accents

Hello!

I have in my volt view the following variable

{{ link_to('dashboard', session.get('user-alias')|upper) }}

When the input is only english characters, like batman it outputs BATMAN ... But when the input is something like josé it outputs JOSé

By the way, the mbstring extension is loaded in my PHP. Any idea on how to elegantly fix this error ?

You can write your own (custom) filter for Volt, where you fix this error. I have the same with cyrillic symbols.

How to create your own filter:

link 1

link 2



11.2k
Accepted
answer
edited Aug '14

Thanks Alexandr for your help but i found that it was even easier.

All I did was

var_dump(mb_internal_encoding());

And I discovered that PHP was so stupid that it was using ISO-8859-1 encoding instead of UTF-8. To fix this I simply executed the following code before my application->handle()

mb_internal_encoding("UTF-8");