【问题标题】:single newline interpreted twice单个换行符解释两次
【发布时间】:2015-08-14 04:18:49
【问题描述】:

我所指的问题已经很好地解释了here

重申一下,使用 google docs api,我可以使用以下 curl 命令读取多种格式的文件

curl -X GET -H "Authorization: Bearer $access_token" "https://docs.google.com/feeds/download/documents/export/Export?id=$fileID&exportFormat=txt"

问题在于 google docs 文件中存在的每个换行符都被解释为两个换行符。

这是有问题的,因为当我更新文件的本地副本并将其上传回谷歌文档时,结果是每个换行符都被视为两个换行符。可以想象,这很快就会失控。

我该如何解决这个问题?

我不能简单地将每个“\n\n”替换为“\n”,因为在某些情况下,用户可能希望将多个换行符放在一起。

我应该如何处理这个问题?

【问题讨论】:

    标签: curl google-docs google-docs-api


    【解决方案1】:

    我最终创建了一个小的 bash 脚本来解决这个问题。

    如果其他人遇到这个问题,这里是我的(工作?)脚本,可能有一些用处。

    https://raw.githubusercontent.com/suhussai/GoogleDocApiScript/master/lineFixer.sh

    【讨论】:

      猜你喜欢
      • 2015-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-12
      • 2011-12-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多