atom / encoding-selector

Pick an encoding for the current editor
MIT License
21 stars 26 forks source link

Correctly detect the encoding or be able to use a default value while opening. #3

Closed alefragnani closed 10 years ago

alefragnani commented 10 years ago

It would be interesting that it would detect the encoding, instead of just allow us to select a new one. Or at least have a default encoding value.

It always opens as UTF-8, but most of the files that I use are Windows 1252 / ISO 8859-1, so I have to manually change every file.

Thanks

kevinsawicki commented 10 years ago

I think it makes sense to add a default encoding to the config, see atom/atom#4141 for more details.

alexandernst commented 10 years ago

Please don't close this. A default encoding config is not the same as encoding detection. Atom should try to guess the encoding as best as it can and only if it fails, fallback to the default encoding. @kevinsawicki

kevinsawicki commented 10 years ago

The issue is the quality of detection libraries, there didn't seem to be one that correctly guessed the desired encoding using the examples from the original issue, https://github.com/atom/atom/issues/1806

There is an auto-detect option in the encoding selector dialog that can be used to try to guess when needed.

alexandernst commented 10 years ago

IMHO, missing library shouldn't be a factor in this issue. If there isn't one, it should be created or maybe patch the one that could get the job done.

The main issue with Atom is that it will try to open files in UTF8 (or the default encoding, if set), which will potentially break any non-UTF8 files. And that, imho, is not an acceptable behavior for any editor. This should be tagged as 1.0 blocker.

alexandernst commented 10 years ago

Also, maybe this could help:

alexandernst commented 10 years ago

@kevinsawicki Should I understand that this bug is not going to be reopened or did you just miss my comments?

kevinsawicki commented 10 years ago

Should I understand that this bug is not going to be reopened

I'd prefer to start a new issue on atom/atom to track this. If auto-detect on open is added, it will have to be done in core since that is where the buffer's are built. This package just handles changing the encoding after the editor is opened via the Editor::setEncoding API.

Would you mind opening an issue there? It will have more visibility than this package repo which few people are probably watching since it is relatively new.

alexandernst commented 10 years ago

@kevinsawicki Ok, I'll open a new bug in /atom