Charset Issue

Discussion in 'HTML & Website Design' started by scottlpool2003, Nov 25, 2013.

  1. #1
    Problem:

    Previous items have been uploaded on a MAC with no charset specified. I've now specified the charset as UTF-8 which has fixed new items uploaded to the database. The previous stories were showing black triangle with a question mark in it for special characters such as ‘ and ”. That was now fixed, but now I had the funny character issues. I took a look in the database and they were uploaded with ‘monster’ those characters in.

    I tried to set the charset on the database query which works but then sets all the new items to those funny characters.

    Is there anything I can do to make everything work properly?
     
    scottlpool2003, Nov 25, 2013 IP
  2. scottlpool2003

    scottlpool2003 Well-Known Member

    Messages:
    1,708
    Likes Received:
    49
    Best Answers:
    9
    Trophy Points:
    150
    #2
    Managed to solve this by setting the charset to UTF-8 and running a preg replace to remove unicoding. Not the most ideal of fixes though.

    
     preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $body);
    
    PHP:
     
    scottlpool2003, Nov 26, 2013 IP