The MU forums have moved to WordPress.org

Special Characters - how to convert them (10 posts)

  1. ColinFilmJournal
    Member
    Posted 17 years ago #

    I'm writing my own search page - all is good and working, however the results sometimes include special characters and I'm having trouble converting them to standard text. For an example click the following link:

    http://filmjournal.net/wp-search.php?term=fights%20the%20good%20fight&what=posts

    There should be an e with an accent rather than é - is there a simple WP function I can call to covert these characters to display correctly?

  2. lunabyte
    Member
    Posted 17 years ago #

    Check it...

    http://us3.php.net/manual-lookup.php?pattern=htmlspec

    First two on the left should fix you up. ;)

  3. ColinFilmJournal
    Member
    Posted 17 years ago #

    Not sure it is a PHP thing as I've never seen encoding like it before. I will give it a shot just in case it works but I assumed it was a Wordpress-specific encoding.

  4. ColinFilmJournal
    Member
    Posted 17 years ago #

    Just tried - didn't make any difference :(

  5. lunabyte
    Member
    Posted 17 years ago #

    Well... damn. :(

    Could it have to do with different character encodings maybe?

    Or someone pasting in a special character maybe?

    Kinda off topic, kinda not, but I'm considering not allowing members to choose their own encoding. Simply to avoid such problems. Although most never change it.

  6. ColinFilmJournal
    Member
    Posted 17 years ago #

    Not sure it is that sort of encoding :(

  7. ColinFilmJournal
    Member
    Posted 17 years ago #

    Ah - it is to do with UTF-8 :) My main page is correctly being detected as such, but despite the correct Content-Type in the header, the search page is coming back as ISO-8859

  8. lunabyte
    Member
    Posted 17 years ago #

    Well, it's at least a step in the right direction.

    I wonder if it would make a difference if you changed the encoding for only that page.

    If it's integrated within MU, then you could define something like custom_search as true, and then in the theme header do an if/else to spit out the content type / encoding.

    Although, without looking at the code, I don't know why it would return and 8859 when it's stated as utf-8 in the head.

  9. ColinFilmJournal
    Member
    Posted 17 years ago #

    I've now set the server to force UTF-8 over and above anything else and it seems to be OK :)

  10. lunabyte
    Member
    Posted 17 years ago #

    Sweet.

    :D

About this Topic

  • Started 17 years ago by ColinFilmJournal
  • Latest reply from lunabyte