1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

accents in url

Discussion in 'Troubleshooting and Problems' started by diego222, Mar 18, 2013.

  1. diego222

    diego222 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.
  2. HWS

    HWS 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.
  3. diego222

    diego222 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?
  4. Jake Bunce

    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.
    14DH01 and HWS like this.
  5. diego222

    diego222 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.
  6. arr0w

    arr0w Member

    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: http://www.yourdomain.com/threads/al-nino-le-gusta-jugar-futbol.3719/
    diego222 and Jake Bunce like this.
  7. diego222

    diego222 Member

    and with xenforo updates we have to re-make this change?
  8. arr0w

    arr0w Member

    That's right. :)
  9. Daniel Bittar

    Daniel Bittar Member

    Well, this could be made the default behavior by XenForo, couldn't it?
    14DH01 likes this.
  10. diego222

    diego222 Member

    It would be a good idea make it by default.
  11. imthebest

    imthebest Formerly Super120

    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?

Share This Page