Jump to content

[SOLVED] I want my server to "allow" single and double quotes


RyanSF07

Recommended Posts

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

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.