[resolved] How does WP remove accents from Polish characters? (2 posts)

  1. Trahald
    Posted 8 years ago #

    What function does WordPress use to convert Polish characters to English equivalents? For instance 'ą' to 'a'.

    List of Polish characters:
    ł ą ż ę ć ń ś ź
    Ł Ą Ż Ę Ć Ń Ś Ź

    When I post these characters in a post title their accents are removed properly by WordPress for the post URL (ł becomes l and so on). But if I manually include wp-includes/formatting.php in a new script outside WordPress, the remove_accents() function leaves these characters as-is, and the sanitize_title_with_dashes() function simply deletes these characters.

    I'd like to convert these characters in a separate plugin. Does anyone know what function is WordPress using for these characters?

  2. Trahald
    Posted 8 years ago #

    I got this working, both remove_accents() and sanitize_title_with_dashes() work. All I had to do was set header('Content-Type: text/html; charset=utf-8'); in the display script.

    Just to note, the difference between remove_accents() and sanitize_title_with_dashes() [other than adding the dashes of course] is that the latter sanitizes out all character other than %, alphanumeric, _ and -, and it also trims whitespace.

Topic Closed

This topic has been closed to new replies.

About this Topic