Jump to content

Recommended Posts

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

DE1NffC.png

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!

Link to comment
https://forums.phpfreaks.com/topic/310734-filtering-weird-characters/
Share on other sites

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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.