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

Auto-detect encoding? #50

Open
endolith opened this issue Jul 6, 2023 · 1 comment
Open

Auto-detect encoding? #50

endolith opened this issue Jul 6, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@endolith
Copy link

endolith commented Jul 6, 2023

Documentation says

  • --encoding: Encoding to use for reading text files [default: utf-8]

But different files have different encodings. Chinese PDF is being read correctly and characters are showing up correctly, but a .txt file in the same folder that's encoded in GB2312 is being garbled in both the search results and the file display.

Probably it should default to detecting the encoding for each file independently and then converting them internally to whatever the embedding expects (UTF8?)

https://pypi.org/project/chardet/

@freedmand freedmand added this to the Semantra 0.2.0 milestone Jul 8, 2023
@freedmand freedmand added the enhancement New feature or request label Jul 8, 2023
@freedmand
Copy link
Owner

Yep, you're absolutely right. This should be granular on a per-file basis. I can look into auto-detecting encoding, but that might be time consuming for ever file, and it might be error prone. In any case, v0.2 should have better controls for customizing how Semantra works per file.

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

No branches or pull requests

2 participants