WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. karlajw
    Member
    Posted 1 year 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:

    John

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

    \"John\"

    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?

    Thanks,
    Karla

    http://wordpress.org/extend/plugins/amr-users/

  2. anmari
    Member
    Plugin Author

    Posted 1 year ago #

  3. karlajw
    Member
    Posted 1 year 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);

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

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

    Thanks,
    Karla

  4. anmari
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Karla,

    Unlikely.

    Magic quotes is not recommended generally, deprecated in php 5.3 and removed in 5.4:
    http://www.php.net/manual/en/security.magicquotes.whynot.php
    http://en.wikipedia.org/wiki/Magic_quotes#Criticism

    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

About this Topic