Search code examples
ipadmobile-safari

Is it possible to use double quotes in CSV files on iPad?


I am having issues with the special CSV interpreter (no idea what its called) on iPad mobile browser.

iPad appears to reserve the character " as reserved or special. When this character appears the string is treated as a literal instead of seperated as a CSV.

INPUT:

1111,64-1111-11,Some Tool 12", 112233

Give the input above, the CSV mobile-safari display shows ([] represents a column)

[1111] [64-1111-11] [Some Tool 12, 112233]

Note that the " is missing. Also note that 112233 is not in its own column like it should be.

Question 2:
How can I get the CSV display tool in safari to not treat a six digit number as a phone number?

1234567

Shows up as a hyperlink and asks to "Add Contact" when I click it. I do not want the hyperlink.


UPDATE
iPad is ignoring the escape character (or backslash is not the escape character) for double quotes in CSV files. I am looking at the hex version of the file and I have

\" or 5C 22 (in hex with UTF-8 encoding).

Unfortuntely, the iPad displays the backslash and still treats " as a special character, thereby corrupting my data formatting. Anybody know how I can possibly use " on iPad CSV?


Solution

  • With regards the quotes, have you tried escaping them in the output?

    EDIT: conventional escaping doesn't work for CSV files, my apologies. Most specifications state the following:

    Fields that contain a special character (comma, newline, or double quote), must be enclosed in double quotes.

    So, testing this on your CSV snippet, a file formatted like this:

    1111,64-1111-11,"Some Tool 12""", 112233
    

    or even like this:

    1111,64-1111-11,Some Tool 12"""", 112233
    

    … opens in Mobile Safari OK. How good or bad that looks in Excel you'd need to check.

    Moving to the second issue, to prevent Mobile Safari from presenting numbers as phone numbers, add this to your page's head element:

    <meta name="format-detection" content="telephone=no" />