Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

词典文件中, 行末尾无'\r'导致读词典失败 #3

Open
nobodxbodon opened this issue Feb 2, 2018 · 6 comments
Open

词典文件中, 行末尾无'\r'导致读词典失败 #3

nobodxbodon opened this issue Feb 2, 2018 · 6 comments

Comments

@nobodxbodon
Copy link
Member

源自 program-in-chinese/overview#53 (comment)

一种办法是删除所有行末的'\r'再提交, 然后分行时只用'\n'?

@nobodxbodon
Copy link
Member Author

是mac系统. 还没在win/linux测试. 也许是mac端git的默认设置问题.

@htwx
Copy link
Collaborator

htwx commented Feb 3, 2018

这个 我改因为操作系统不同的原因 分行符不一样造成的

@htwx
Copy link
Collaborator

htwx commented Feb 3, 2018

这个是 拼音的 vsc 插件 及拼音服务的代码
https://github.com/program-in-chinese/vscpinyin
这个是 cts 语言服务的插件代码
https://github.com/program-in-chinese/vsc_cts
这个是cts 编译器代码
https://github.com/program-in-chinese/CTS

@nobodxbodon
Copy link
Member Author

刚在英文windows测试了, 和mac结果一样, 也没有'\r'. 你试试从git上clone下来在本机跑一下?

@nobodxbodon
Copy link
Member Author

估计你的git是自动把CRLF(\r\n)转换成LF(\n)的: http://blog.csdn.net/xuewuzhijin2012/article/details/50117181
官方文档: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace
希望能够实现跨平台开发. 顶楼的建议你觉得可行吗?

@nobodxbodon
Copy link
Member Author

另一种方案是, 在"分行读"中, 用

文本.split("\n");

然后把分出来的字段中的'\r'替换成"". 不过这样会使已经很长的读字典时间变得更长吧.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants