Jump to content

Importing CSV files - Quatations marks appear as a ? mark


jonw118

Recommended Posts

Hello all- I thank you greatly in advance for any help...

 

I have a CSV file I am importing into my MySQL database and have a problem:

 

One of the cells I am importing uses quotations marks in the description (they need to be there!), but unfortunately, when I import it changes the quatations mark to a ? mark sign.

 

I changed "Fields terminated by" to a "+" and changed "fields enclosed by" to a ","... but this did nothing for me.

 

Again, I'd appreciate any help.

 

Thanks!

Those aren't regular quotes you're dealing with...they are 'Magic Quotes'!

 

And a magical pain in the ass.  Try replacing them as follows:

 

$string = preg_replace('/[\x91\x92]/u', "'", $string);

$string = preg_replace('/[\x93\x94]/u', '"', $string);

 

Oh wow, so right now the cell reads:

 

W90” x D39” x H31”

 

In the CSV file what would I change that to read???

 

Is this what you are saying?

 

W90string = preg_replace('/[\x91\x92]/u', "'", $string);

$string = preg_replace('/[\x93\x94]/u', '"', $string); x D39string = preg_replace('/[\x91\x92]/u', "'", $string);

$string = preg_replace('/[\x93\x94]/u', '"', $string); x H31string = preg_replace('/[\x91\x92]/u', "'", $string);

$string = preg_replace('/[\x93\x94]/u', '"', $string);

 

 

sorry i should've explained that better. 

 

I was giving advice on how to replace magic quotes with normal quotes in a php script, which you could do prior to an INSERT query. I'm not sure how you would issue this command in a text editor.  If nobody else answers here, just look up 'find and replace magic quotes'  on google.

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.