RyanSF07 Posted April 28, 2007 Share Posted April 28, 2007 Hi All, I'm working on a language learning website where teachers are uploading questions like: What does, "How ya do'n?" mean? I haven't added anything to my code that restricts what types of punctuation can be uploaded to the database. However, when single or double quotes are inserted along with text, the quotes come back as symbols+text, or parts of the text has been deleted, or backslashes appear before some punctuation. I asked my hosting provider if I could solve this problem with a php.ini dirrective (?) They got back to me that it might be a character collation issue, and that I could change the default from Latin1 to something else, but I still don't understand how that would solve the problem.. wouldn't the same thing happen with a different character collation? I wonder if any of you have had this problem, and how you fixed it. Thank you very much for your help. Ryan Link to comment https://forums.phpfreaks.com/topic/49043-solved-i-want-my-server-to-allow-single-and-double-quotes/ Share on other sites More sharing options...
mmarif4u Posted April 28, 2007 Share Posted April 28, 2007 I think u should try UTF8 characters. Link to comment https://forums.phpfreaks.com/topic/49043-solved-i-want-my-server-to-allow-single-and-double-quotes/#findComment-240281 Share on other sites More sharing options...
sanfly Posted April 28, 2007 Share Posted April 28, 2007 Why not use addslashes() before storing anything in your database, and stripslashes() when you retrieve it You may also want to check the status of get_magic_quotes PHP Manual Link to comment https://forums.phpfreaks.com/topic/49043-solved-i-want-my-server-to-allow-single-and-double-quotes/#findComment-240290 Share on other sites More sharing options...
RyanSF07 Posted April 28, 2007 Author Share Posted April 28, 2007 addslashes() before storing anything in your database, and stripslashes() I think this would work best. Could you give me a simple, straight forward example of how you use this? thanks very much for the tip and link Ryan actually... this looks to be about as straight forward as it gets: (from php.net) <?php $str = "Is your name O'reilly?"; // Outputs: Is your name O\'reilly? echo addslashes($str); ?> thanks again, and if you have any other suggestions please let me know Link to comment https://forums.phpfreaks.com/topic/49043-solved-i-want-my-server-to-allow-single-and-double-quotes/#findComment-240295 Share on other sites More sharing options...
RyanSF07 Posted April 28, 2007 Author Share Posted April 28, 2007 What is the advantage of UTF8 over Latin1? thanks! Link to comment https://forums.phpfreaks.com/topic/49043-solved-i-want-my-server-to-allow-single-and-double-quotes/#findComment-240306 Share on other sites More sharing options...
mmarif4u Posted April 28, 2007 Share Posted April 28, 2007 U can store different languages character correctly. Link to comment https://forums.phpfreaks.com/topic/49043-solved-i-want-my-server-to-allow-single-and-double-quotes/#findComment-240315 Share on other sites More sharing options...
RyanSF07 Posted April 28, 2007 Author Share Posted April 28, 2007 U can store different languages character correctly. Alright - I'll try this. Thanks very much for the help! Ryan Link to comment https://forums.phpfreaks.com/topic/49043-solved-i-want-my-server-to-allow-single-and-double-quotes/#findComment-240319 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.