escaping special characters in import csv file

  • Posts: 29
  • Thank you received: 1
10 years 11 months ago #134486

-- HikaShop version -- : 2.2.2
-- Joomla version -- : 2.5
-- PHP version -- : 5.5.3

Hi,

I haven't found any description about how to escape special characters in the import CSV file.
I found that comma must be just escaped by a backslash: \,
But how to do with the double quote?

Here is an example for the import file content:

category, product_code, product_name, product_description
"cat1", "001", "prod1", "descr1 Blah blah\, blah blah blah \"blah blah\". descr1 end"
"cat1", "002", "prod2", "descr2 Blah blah\, blah blah blah \"blah blah\". descr2 end"

In case of an import like the above I always get the next message:
The line '"cat1", "001", "prod1", "descr1 Blah blah\, blah blah blah \"blah blah\". descr1 end"' could not be imported
The line '"cat1", "002", "prod2", "descr2 Blah blah\, blah blah blah \"blah blah\". descr2 end"' could not be imported

How should I import texts including double quotes. And including other specal characters?

Thanks .

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 11 months ago #134497

Hi,

Like most CSV compatible systems, double quotes can be escaped with another double quote.
www.google.com/search?q=escape+double+qu...10&es_sm=93&ie=UTF-8

So it should be:
category, product_code, product_name, product_description
"cat1", "001", "prod1", "descr1 Blah blah, blah blah blah ""blah blah"". descr1 end"
"cat1", "002", "prod2", "descr2 Blah blah, blah blah blah ""blah blah"". descr2 end"

Normally, commas don't have to be escaped if the string they are in is double quoted.

Please Log in or Create an account to join the conversation.

  • Posts: 29
  • Thank you received: 1
10 years 11 months ago #134584

Thank you!

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum