是否可以在 iPad 上的 CSV 文件中使用双引号?

发布于 2024-11-17 04:39:28 字数 936 浏览 1 评论 0原文

我在 iPad 移动浏览器上使用特殊的 CSV 解释器(不知道它叫什么)时遇到问题。

iPad 似乎将字符 " 保留为保留或特殊字符。当出现此字符时,字符串将被视为文字,而不是作为 CSV 分隔。

输入:

1111,64-1111-11,一些工具 12", 112233

给出上面的输入,CSV mobile-safari 显示显示([] 代表一列)

[1111] [64-1111-11] [某些工具 12, 112233]

请注意,缺少 "。另请注意,112233 不像它那样位于其自己的列中应该是。

问题 2:
如何让 safari 中的 CSV 显示工具不将六位数字视为电话号码?

1234567

显示为超链接,单击它时要求“添加联系人”。我不想要超链接。


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

\" 或 5C 22 (采用 UTF-8 编码的十六进制)。

不幸的是,iPad 显示反斜杠,但仍将 " 视为特殊字符,从而破坏了我的数据格式。有人知道我如何在 iPad CSV 上使用 " 吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月蹉跎了容颜 2024-11-24 04:39:28

关于引号,您是否尝试过在输出中转义它们?

编辑:传统转义不适用于 CSV 文件,抱歉。大多数规格说明如下:

包含特殊字符(逗号、换行符或双引号)的字段必须用双引号括起来。

因此,在您的 CSV 片段上进行测试,文件格式如下:

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

或者甚至像这样:

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

… 在 Mobile Safari 中打开,OK。您需要检查一下 Excel 中的效果是好是坏。

转到第二个问题,要防止 Mobile Safari 将号码显示为电话号码,请将其添加到页面的 head 元素中:

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

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" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文