br3nn4n Posted March 26, 2008 Share Posted March 26, 2008 Using just a simple form to enter in the data to a mysql database, on some computers after entering the data it displays on the site as something like this: students’ where the "’" should be an " ' ". Any way to fix this without having to go back in and edit every one of the occurances? Link to comment https://forums.phpfreaks.com/topic/98029-certain-characters-not-showing-right/ Share on other sites More sharing options...
soycharliente Posted March 26, 2008 Share Posted March 26, 2008 Is the data being copied and pasted from text editors or something? I've run into that problem before as different text editors or document programs (like MS Word) us different encodings to store the data. If you're running into the problem while grabbing data from a textarea or input, try using htmlspecialchars() Link to comment https://forums.phpfreaks.com/topic/98029-certain-characters-not-showing-right/#findComment-501575 Share on other sites More sharing options...
effigy Posted March 26, 2008 Share Posted March 26, 2008 It's UTF-8 encoded. If you run those characters through a hex editor you'll get "E2 80 99." Looking these up in a letter database shows the character. What character set is your site and database set up for? Link to comment https://forums.phpfreaks.com/topic/98029-certain-characters-not-showing-right/#findComment-501590 Share on other sites More sharing options...
br3nn4n Posted March 27, 2008 Author Share Posted March 27, 2008 You got it, dead on the text is being copied from PDF files which are put together in a page designer program that supports special characters like Word uses. Often the text IS copied directly from Word docs, actually. So running it through htmlspecialchars() would do what? My site is set to iso-8859-1, i'll have to check on the database. Link to comment https://forums.phpfreaks.com/topic/98029-certain-characters-not-showing-right/#findComment-501891 Share on other sites More sharing options...
effigy Posted March 27, 2008 Share Posted March 27, 2008 I believe Word works in CP1252. You can see if iconv will convert CP1252 into ISO-8859-1. If not, you'll need to write your own conversion to handle the 0x80 - 0x9F range. Link to comment https://forums.phpfreaks.com/topic/98029-certain-characters-not-showing-right/#findComment-502214 Share on other sites More sharing options...
br3nn4n Posted March 28, 2008 Author Share Posted March 28, 2008 I could write my own I suppose, but what if I just change the mysql to cp1252? Will that fix anything? Link to comment https://forums.phpfreaks.com/topic/98029-certain-characters-not-showing-right/#findComment-503508 Share on other sites More sharing options...
effigy Posted March 28, 2008 Share Posted March 28, 2008 You could since 1252 is a superset of 8859-1; make sure you change your meta too. Are you always going to receive data in 1252? Link to comment https://forums.phpfreaks.com/topic/98029-certain-characters-not-showing-right/#findComment-503517 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.