Jump to content

Sanitizer->pageName vs actual page names


Recommended Posts

Just a short question about sanitizer->pageName.

if I have a page title that has scandic letters in it. "Pääskynen" as an example, the pagename will be "paaskynen", but if I use sanitizer->pageName on it, I will get "pskynen" instead. 

Would it be possible to get what the backend sanitizer does with page names, or is there another sanitizer that works in similar way (changing ä > a instead of dropping letters)?

Link to comment
Share on other sites

I think the backend uses  pageName with the argument/option 'beautify'.

You can either use this:



Name filter for ProcessWire Page names with transliteration

This is the same as calling pageName with the Sanitizer::translate option for the $beautify argument.

Or this, with beautify argument:



Sanitize as a ProcessWire page name

  • Page names by default support lowercase ASCII letters, digits, underscore, hyphen and period.

  • Because page names are often generated from a UTF-8 title, UTF-8 to ASCII conversion will take place when $beautify is enabled.

  • You may optionally omit the $beautify and/or $maxLength arguments and substitute the $options array instead.

  • When substituted, the beautify and maxLength options can be specified in $options as well.

  • If $config->pageNameCharset is "UTF8" then non-ASCII page names will be converted to punycode ("xn-") ASCII page names, rather than converted, regardless of $beautify setting.


Edited by kongondo
  • Like 2
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...