Jump to content

Getting my head around stripslashes


thered

Recommended Posts

Hi I'm a bit if a beginner but have done a few small websites.

 

I've just been in touch with my hosting company and they have magic_quotes on and can't turn them off as it's a shared server, fair enough.  I'm not sure this is my problem anyway ::)

 

I write information which has been cut and pasted from a word processor to a mysql database - for this I use addslashes() and to write it to the webpage I use stripslashes() - this works ok.  Until today, when I decided to move into the murky world of AJAX.

 

When I return stuff now from the database I get strange characters - a diamond with a '?' in it.  I've Googled this but most stuff tell me to turn off magic_quotes or hack the .htaccess file -neither it seems I have access to.

 

Any ideas why it doesn't work with httpRequest stuff?

 

cheers TIA  ;D

Link to comment
Share on other sites

No doubt, it's something to do with character sets and character encoding and all that malarkey.

 

That's pretty much all I can tell you.

 

HOWEVER...

 

I write information which has been cut and pasted from a word processor

Oh really? Try copying the information from the word processor, into a program like Notepad. THEN copy it into the Database, tell me what happens.

Link to comment
Share on other sites

Sorry, I probably didn't describe that too well. It is cut and pasted into a 'textarea' in a form then inserted to the database using addslashes. 

 

This is carried out by the girls in the office so making another step of putting into a text editor first won't be met with smiles  ::)

 

However I'll try it tomorrow.  Anyway, as already  said, it works ok normally -it's just when I get the information using AJAX that it adds the special characters (or doesn't remove them)

Link to comment
Share on other sites

All I'm saying is, Word Processors have a habit of ... adding weird characters into things. If you copy it into Notepad (just as a test, it's not like the "Office girls" will have to do this all the time!) then copy it into the Database and see if you still get the problems.

 

Anyway, no doubt someone else will come along and be able to fix your problems... I tried. :P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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