karmacrow Posted February 7, 2007 Share Posted February 7, 2007 Hi everyone I am trying to replace some specific characters in a file but I am not being able to do this. It is a type of apostrophe... For example in the following text excerpt <td class="card" align='left'> Night’s Whisper </td> I would like to replace the ’ in the word Night. However when putting the file contents into a string (via fopen and co) and the using $contents = str_replace("’","'",$contents); nothing happens, and nothing is replaced. How can I replace this type of characters. I have very little idea about text encoding and the likes so any help will be heavily appreciated. Thanks a lot Quote Link to comment Share on other sites More sharing options...
effigy Posted February 7, 2007 Share Posted February 7, 2007 Your code works for me. Those quotes are called "Smart Quotes" and are part of the Windows-1252 encoding. You can try using mb_convert_encoding to see if the quotes will "return to normal," or you can use regular expressions to replace them; their values are below: 0x91 - Left single quote 0x92 - Right single quote 0x93 - Left double quote 0x94 - Right double quote Quote Link to comment 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.