Sublime Forum

[ST3] Reading a file with unicode characters file

#1

I’m using a plugin that uses python ‘open’ to open files and read the content; under Ubuntu it works perfectly but under MacOSX if the file contains unicode characters like ⇒ , it fails. The error is:

The line of code that is failing is:

https://github.com/sublimescala/sublime-ensime/blob/ST3/diff.py#L8

It’s just a simple open(…).read() that works under Ubuntu so… I’m really confused.

P.S. I’m using SublimeText3 latest development version.

0 Likes

#2

This really should be filed under plugin development, because this isn’t a bug, but just a misunderstanding of how to work with unicode in python.

Check out how I open utf-8 files in one of my plugins: github.com/facelessuser/RawLine … dit.py#L70.

0 Likes

#3

Thank you. I will checkout the project and try that. If it works I will submit a PR to the plugin creator.

[quote=“facelessuser”]This really should be filed under plugin development, because this isn’t a bug, but just a misunderstanding of how to work with unicode in python.

Check out how I open utf-8 files in one of my plugins: github.com/facelessuser/RawLine … dit.py#L70.[/quote]

0 Likes