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

Added support for non UTF-8 encoded files. #90

Closed
wants to merge 1 commit into from
Closed

Added support for non UTF-8 encoded files. #90

wants to merge 1 commit into from

Conversation

davidolrik
Copy link

TrailingSpaces fails to run on non UTF-8 files.

This small fix extracts the encoding from the view(current file), and uses that encoding for opening the file.

@FichteFoll
Copy link
Member

Sublime Text's encoding names are very different from Python's. sublime_lib has a bidirectional mapping for those, but I believe the "read file from disk" solution to be very fragile in the first place. I don't see why getting the text from view.substr isn't an option.

@rchl
Copy link
Member

rchl commented Mar 22, 2020

@FichteFoll reading file from disk is used for the "show only trailing spaces in modified lines" feature. Do you see any other way of implementing it? I don't immediately see any API we could use for that.

@FichteFoll
Copy link
Member

I was thinking of loading the file into memory using view.substr when the file is loaded or first activated, but I just realized that this assumption fails when recovering a hot-exited session. I presume reading from the file is still necessary in that case, but using the encoding mapping provided by sublime_lib instead.

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

Successfully merging this pull request may close these issues.

3 participants