如何在 CouchDB 附件中保留换行符?
我将 CSV 格式的文件作为附件保存在 CouchDB 中,但是当我检索它们时,换行符丢失了。我应该采取什么不同的措施来保留换行符?
% cat -vet foo.csv
line1-field1, line1-field2, line1-field3$
line2-field1, line2-field2, line2-field3$
% curl -X PUT -H "Content-type: text/csv" -d @foo.csv $SERVER/testdb/testdoc/foo
{"ok":true,"id":"testdoc","rev":"1-fe07e847a7934a14055890ff3d8f5603"}
% curl -X GET $SERVER/testdb/testdoc/foo |cat -vet
line1-field1, line1-field2, line1-field3line2-field1, line2-field2, line2-field3%
I'm saving CSV-formatted files as attachments in CouchDB, but when I retrieve them the newlines are missing. What should I do differently to preserve the newlines?
% cat -vet foo.csv
line1-field1, line1-field2, line1-field3$
line2-field1, line2-field2, line2-field3$
% curl -X PUT -H "Content-type: text/csv" -d @foo.csv $SERVER/testdb/testdoc/foo
{"ok":true,"id":"testdoc","rev":"1-fe07e847a7934a14055890ff3d8f5603"}
% curl -X GET $SERVER/testdb/testdoc/foo |cat -vet
line1-field1, line1-field2, line1-field3line2-field1, line2-field2, line2-field3%
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于某种原因,curl 似乎正在剥离换行符。我已经通过强制二进制设法避免了它:
It seems that curl is striping newlines for some reason. I've managed to avoid it by forcing binary: