amr users
[resolved] Extra escaped quotes in CSV file (4 posts)

  1. karlajw
    Posted 3 years ago #

    When I export a CSV file on my local development website (a wamp setup) and open it in Excel everything looks fine. But when I do the same thing on the live website the CSV file opened in Excel ends up with the field delimiters escaped. For example:

    on my local web one entry in the Name column looks like this:


    but then that same Name column generated by the live website (on a different web hosting provider) looks like this:


    Since the big difference between the two files is the server they were generated on I'm guessing there may be some sort of server-side setting that can (hopefully) be changed to remove the extra escaping.

    Can anyone point me in the right direction?



  2. anmari
    Plugin Author

    Posted 3 years ago #

  3. karlajw
    Posted 3 years ago #

    Thanks Anmari.

    I had also posted the same question to our hosting provider and he confirmed that the problem was due to the magic-quotes setting.

    He pointed out:

    The htmlspecialcharacters_decode() function turns   into > and & into & etc. it does not turn \" into " properly.

    and by making the following change to the plugin was able to get rid of the extra \"

    I changed line 14 from:

    amr_to_csv (htmlspecialchars_decode($_POST['csv']),$suffix);

    amr_to_csv (stripslashes(htmlspecialchars_decode($_POST['csv'])),$suffix);

    Is there any chance you would make this change a part of the plugin?


  4. anmari
    Plugin Author

    Posted 3 years ago #

    Hi Karla,


    Magic quotes is not recommended generally, deprecated in php 5.3 and removed in 5.4:

    Therefore no point in incurring the overhead and risk of possible side effects on text within fields in using stripslashes .

    Better to switch off magic quotes.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • amr users
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic