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

解决 PapaParse 获取 URL 文件编码错误 | Mst #29

Open
MskTmi opened this issue Nov 15, 2023 · 0 comments
Open

解决 PapaParse 获取 URL 文件编码错误 | Mst #29

MskTmi opened this issue Nov 15, 2023 · 0 comments

Comments

@MskTmi
Copy link
Owner

MskTmi commented Nov 15, 2023

https://blog.msktmi.com/posts/2023/97572495.html

​PapaParse 这个插件虽说强大,可以快速将 CSV 文件转为 JSON 格式来渲染表格,但是某些地方真的让人很难受,比如它自带的 encoding 配置只能对通过 input 上传的本地文件起作用,而通过 URL 远程取到的文件不支持… 解决方案先用 XMLHttpRequest() 获取到文件,然后设置 FileReader() 改变文件的编码,最后使用 PapaParse 直接解析。

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

No branches or pull requests

1 participant