accents in url


Active member

There's no problem accesing the forum, but when we have an url with an accent, it changes to "html code" instead of directly put it with the accent. Example:

instead of

And I supose it will happen with "Ñ" too.

When we paste it in mozilla/chrome/etc... it change automatically, but when we paste in some text editor or even in a navigator (before pressing Enter), it have html code on url.


Well-known member
It is safer that way. Not all browsers understand foreign characters in URLs and the link will fail without the encoding.

It is not HTML btw, it is url-encoding standard.


Active member
well... html.. url-encoding, I didn't know how to say it :). I mean if there's something we can do to when we write "acción" it changes automatically to "accion" in url. And when we write "españa" it change automatically to "espana".

But then, there's no problem having it with accents?

Jake Bunce

XenForo moderator
Staff member

I think you want these functions:


There is a $romanize flag in those functions which might be what you need. You could change the default value to true. That will replace accented characters with non-accented ones thereby avoiding all URL encoded characters.


Active member
:oops: too complicated for me.

But it doesn't matter. If there's no problem with browsers or with google (like it or not, G is God), then it's fine.
Edit the file library/XenForo/Link.php.


public static function buildIntegerAndTitleUrlComponent($integer, $title = '', $romanize = false)
Change it to:

public static function buildIntegerAndTitleUrlComponent($integer, $title = '', $romanize = true)
Save the file and re-upload it. ;)

So if you make a thread with this title: "Al niño le gusta jugar fútbol", the thread URL will be:


Well-known member
Sorry for necroposting but is there a better way (without file edits) to prevent accents and strange characters like "ñ" to appear on the URLs generated by XF?