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

╄→尐↘猪︶ㄣ 提交于 2020-01-06 08:17:19

问题


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?


回答1:


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" />


来源:https://stackoverflow.com/questions/6470400/is-it-possible-to-use-double-quotes-in-csv-files-on-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!