网友们,这个小程序返回我指定文件的前两个字符
这让我感到惊讶,因为源文件包含几百行文本。
我究竟做错了什么?有人能更聪明地发现我的错误吗?谢谢你! :-D
-- This script will import to-dos and notes into Things from a plaintext file.
-- To run the script, click the green "Run" button in the toolbar above.
-- source: https://culturedcode.com/things/support/articles/2803555/#import-from-a-plain-text-file
set unixPath to "/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/Obsidian development/wealthyvault/bin/logs/things-commit.db"
-- set text_file to (open for access (POSIX file unixPath))
set text item delimiters to tab
set database_text to (read POSIX file unixPath as «class utf8»)
set numparagraphs to (count paragraphs of database_text)
return database_text
我能够通过将
<<utf8>>
更改为string
来解决我的问题:
set database_text to (read POSIX file unixPath as «class utf8»)
成为
set database_text to (read POSIX file unixPath as string)
我不知道为什么,但这解决了问题。