Results 1 to 8 of 8

Thread: Character encoding problems - can't get tildes to appear correctly.

  1. #1

    Join Date
    Jan 2005
    Location
    Around Here
    Posts
    132
    Rep Power
    13

    Character encoding problems - can't get tildes to appear correctly.

    I'm beating my head against a wall because I can't understand why tilde's are not working on my website. It seems they were working before and now they are not.

    My entire site has a character encoding of UTF-8. I checked MySQL and it's also set to UTF-8. But when I visit a page on my site that contains special characters like tildes or accents (e.g. ), they appear as a question mark (?). I'd attach a screenshot but this stupid forum's upload feature won't let me attach a .jpg file because it says it's an "invalid image format." Nice.

    Anyway, I can't figure out what's wrong. The PHP.INI file never had a straight encoding designation, but just for kicks, I explicitly set it to UTF-8. Still nothing. I added meta tag headers to explicitly set the character encoding. Still nothing.
    I checked how the characters physically appear in MySQL using PHPMyAdmin....they appear correctly as expected.

    So why won't my website render the accents???!?!? So frustrating.

  2. #2
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    West Virginia
    Posts
    3,457
    Rep Power
    22
    Try
    Code:
    & # 126 ; (w/o the spaces)
    for a tilde. Visit this site for more HTML codes - http://www.ascii.cl/htmlcodes.htm
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  3. #3

    Join Date
    Jan 2005
    Location
    Around Here
    Posts
    132
    Rep Power
    13
    Yes, I know how to brute-force character encode but the problem is that I shouldn't have to do that. If I set everything to UTF-8, then it should be stored in MySQL as UTF-8 and it should render as UTF-8. And, if I were to brute-force encode like that, then my web application will just revert the encoding to the actual accented character instead of the brute-force character encoding once I make an update using an online form, and it will get stored in the database as the actual character, not the character entity.

    I have 10 years worth of encoding that is now not rendering correctly when it was in the recent past. And I don't know why.

  4. #4
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    West Virginia
    Posts
    3,457
    Rep Power
    22
    What browser do you use? Try viewing your website with a different browser, see if there is any difference.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  5. #5

    Join Date
    Jan 2005
    Location
    Around Here
    Posts
    132
    Rep Power
    13
    It fails on all the major browsers: IE, Edge, Chrome, Firefox.

    If I do "echo mb_detect_encoding($DatabaseContent)" of the content coming from MySQL, it returns "UTF-8". So I know the content is being returned as UTF-8. But, for some unknown reason, it simply won't render the accent marks and tildes correctly.

  6. #6
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    West Virginia
    Posts
    3,457
    Rep Power
    22
    Oh. I'm kinda at a loss as to what to suggest next. I use iso-8859-1 encoding for my site. I use PHP extensively, but hardly any MySQL. Well, none at all right now..
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

  7. #7

    Join Date
    Jan 2005
    Location
    Around Here
    Posts
    132
    Rep Power
    13
    Ok, thanks, snowmaker. I'll keep digging.

  8. #8
    target='_blank' snowmaker's Avatar
    Join Date
    Nov 2002
    Location
    West Virginia
    Posts
    3,457
    Rep Power
    22
    Good Luck bud.
    -bruce /* somdcomputerguy */
    'If you change the way you look at things, the things you look at change.'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •