Strahan Posted May 9, 2020 Share Posted May 9, 2020 Hi. I made a website to keep track of where I am in various manga. I noticed that sometimes the title I grab looks OK when rendered on the page but in the database it's weird looking I did a for ($x=0; $x<strlen($title); $x++) loop and dumped $x, char at $ pos and ord of char: 0 = T = 84 1 = h = 104 2 = e = 101 3 = = 32 4 = D = 68 5 = e = 101 6 = m = 109 7 = o = 111 8 = n = 110 9 = = 32 10 = K = 75 11 = i = 105 12 = n = 110 13 = g = 103 14 = � = 226 15 = � = 128 16 = � = 153 17 = s = 115 18 = = 32 19 = D = 68 20 = a = 97 Is there some nifty built in function for converting that weird stuff to a regular apostrophe (and convert any other weird stuff)? I mean, I can write a filter to look for 226/128/153 and replace with ' but I'm sure there must be a proper way to handle that stuff. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/310734-filtering-weird-characters/ Share on other sites More sharing options...
kicken Posted May 9, 2020 Share Posted May 9, 2020 You're seeing those characters because the data is UTF-8 encoded (which is generally a good thing) but whatever tool your using is not interpreting it as UTF-8. If you really want to convert it, then maybe try mb_convert_encoding, however the better thing to do is fix (or replace) your tool with one that understands UTF-8 and shows the data properly. Quote Link to comment https://forums.phpfreaks.com/topic/310734-filtering-weird-characters/#findComment-1577756 Share on other sites More sharing options...
Strahan Posted May 10, 2020 Author Share Posted May 10, 2020 Ahh. OK, sounds good. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/310734-filtering-weird-characters/#findComment-1577791 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.