Jump to content

Capitalized Cyrillic letters stripped out: a Sanitizer::translate bug?


Valery
 Share

Recommended Posts

Hello, everyone.

I am building a web site for Cyrillic-reading audience. I wanted to convert Cyrillic user names into ASCII and it seems I found a problem.

Capitalized Cyrillic letters are stripped out after Sanitizer::translate. E.g. "Иван" becomes "van".

There's a workaround, however:

$sanitizer->pageName(mb_strtolower($text), Sanitizer::translate); 

This problem also impacts page name translations to ASCII, so whenever I create a page from the Admin backend, I have to get back after saving, and correct the page name. Here I cannot use the above workaround because I can damage the PW core (which is the last thing one would like to do).

I am posting this for any other developers working with Cyrillic, and maybe for Ryan to look at this issue :)

Thanks!

Link to comment
Share on other sites

$sanitizer->pageName(mb_strtolower($text), Sanitizer::translate);

The mb_strtolower($text) isn't necessary in the above line, as when you specify Sanitizer::translate, that's already the first thing it does in the pageName function. 

This problem also impacts page name translations to ASCII, so whenever I create a page from the Admin backend, I have to get back after saving, and correct the page name. Here I cannot use the above workaround because I can damage the PW core (which is the last thing one would like to do).

Take a look at the module settings in Modules > Inputfield > Page Name -- from here you can specify your own translation table for how characters should be translated. Is this what you are looking for, or something different?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...