jps wrote:* There's now a default_encoding setting, which is consulted when saving new files for the first time. Because this is a regular setting, it means default encodings can be specified per-syntax and per-project. The default value is UTF-8.
I suppose I can remove my own plugin:
- Code: Select all
def on_pre_save(self, view):
def_encoding = view.settings().get("default_encoding")
if view.encoding() == 'Undefined':
if def_encoding is not None:
It works great, thanks a lot! And I don't even have to change my settings name
Now there are still an issue for me:
My .pas (Pascal) files have the default_encoding and fallback_encoding to "Western (Windows 1252)" and are saved correctly when I create a new file. OK
When opened, .pas files that contains non ascii char. use the fallback_encoding. OK
BUT, if a .pas file contains only ascii char., the fallback_encoding is not used and the file is marked UTF-8. If I add non ascii char. to this file, next time I save it it will encoded in UTF-8.
But actually I couldn't find a way to resolve cleanly this issue...