Home Download Buy Blog Forum Support

[ST3] getpreferredencoding

[ST3] getpreferredencoding

Postby sbarex on Tue Aug 13, 2013 3:38 pm

I have some problems regarding utf8 decoding in some pluglins (modific, rsub, ...).
When the plugin read a file or a socket show a error like:
raceback (most recent call last):
File "X/socketserver.py", line 610, in process_request_thread
File "X/socketserver.py", line 345, in finish_request
File "X/socketserver.py", line 666, in __init__
File "/Users/sbarex/Library/Application Support/Sublime Text 3/Packages/rsub/rsub.py", line 143, in handle
line = socket_fd.readline()
File "X/encodings/ascii.py", line 26, in decode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1836: ordinal not in range(128)

in the console I type:
import locale

the output is 'US-ASCII' and not 'utf-8'.
I think this is the problem but I don't know how resolve it.

I'm on OSX 10.8.
Posts: 5
Joined: Fri Nov 18, 2011 8:30 pm

Re: [ST3] getpreferredencoding

Postby robjwells on Fri Sep 13, 2013 5:39 pm

I’ve just had a similar problem (with BBEdit), where my Python locale’s preferred encoding was also US-ASCII.

The solution was to explicitly set LANG in my ~/.bash_profile.
As a British English user, it reads: export LANG="en_GB.UTF-8"

For safety, I’ve also included that line in ~/.bashrc (as non-login shells don’t read .bash_profile).
Posts: 1
Joined: Fri Sep 13, 2013 5:34 pm

Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 37 guests