jason97673 Posted July 18, 2007 Share Posted July 18, 2007 Not sure if this would be in the right category because it could be a database, PHP, or HTML problem. I dont know how to explain with words, so look at the attached picture. http://sykotic-designz.org/strange.JPG That is basically just an article stored in a DB. Now you see those strange characters? Is there a way to get rid of them? Basically all the data entered in the system has been copied and pasted which I know makes those characters appear because when I copy " ' " from a PDF to a text file it displays weird also. I dont know if I should change the type of field in the Database from text to varchar or text to something else perhaps, or something in the PHP code I use can get rid of those. Any help appreciated, thanks. Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 18, 2007 Share Posted July 18, 2007 http://en.wikipedia.org/wiki/Smart_quotes Whatever source you copied that from is using non-standard apostrophes, probably a "smart quote." If you can find out what character it really is (find the ASCII code), you can replace it with a normal apostrophe. Quote Link to comment Share on other sites More sharing options...
jason97673 Posted July 18, 2007 Author Share Posted July 18, 2007 Yeah I have heard of ASCII but is changing every single entry in the database manually the only way to go about doing it? Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 18, 2007 Share Posted July 18, 2007 Eh, no, not manually. Once you figure out what character you need to replace, just run UPDATE table SET column=REPLACE(column, CHAR(?), "'") on the table where ? will be the ASCII code of the character you need to replace. You'll probably have to figure out the ASCII value manually. You can just make a new entry in the table with ONLY a weird character as the content and maybe do a SELECT ORD(content) FROM table WHERE id=?.... Let me know if it works. Quote Link to comment Share on other sites More sharing options...
jason97673 Posted July 18, 2007 Author Share Posted July 18, 2007 Ok here is what I have UPDATE books SET description=REPLACE(description, CHAR('), "’") Description being the column that has the strange characters in. And books is the table But it has an error in syntax near '), "’") Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 18, 2007 Share Posted July 18, 2007 Hmm, CHAR(39) is an apostrophe, so that isn't going to help, I think. Quote Link to comment Share on other sites More sharing options...
jason97673 Posted July 18, 2007 Author Share Posted July 18, 2007 Hm well actually, I got help somewhere else and in my HTML I just had to change <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> to <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" /> And that fixed everything, but thanks for the help anyway! Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 18, 2007 Share Posted July 18, 2007 Cool... glad you got it sorted. 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.