gornostal / Modific

Highlight lines changed since the last commit (supports Git, SVN, Bazaar, Mercurial and TFS) / ST2(3) plugin
614 stars 44 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 215: ordinal not in range(128) #55

Closed fobdy closed 10 years ago

fobdy commented 10 years ago

OS X 10.9 SublimeText 3 When using Modific

Exception in thread Thread-16:
Traceback (most recent call last):
  File "X/threading.py", line 639, in _bootstrap_inner
  File "Modific in /Users/fbd/Library/Application Support/Sublime Text 3/Installed Packages/Modific.sublime-package", line 115, in run
  File "X/subprocess.py", line 906, in communicate
  File "X/subprocess.py", line 1531, in _communicate
  File "X/subprocess.py", line 831, in _translate_newlines
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 215: ordinal not in range(128)
fobdy commented 10 years ago

I think this is related to https://github.com/gornostal/Modific/pull/48

gornostal commented 10 years ago

Can you provide the steps to reproduce please?

fobdy commented 10 years ago

When i open an utf-8 file (.js) with cyrillic encoding it produces the error above.

cartazio commented 10 years ago

i'm having this exact problem myself too

gornostal commented 10 years ago

Hi everyone, I should have addressed this issue long time ago, but the problem is I can't find a mac. I made several attempts to install OSX on VirtualBox under Ubuntu and Windows, but had no luck so far.

Just want to let you know, I'm aware of this issue and it will be fixed.

cartazio commented 10 years ago

I think the problem is python 3's approach to encode != python 2s

i'm going to see if i can sort out a patch right now.

Rowno commented 10 years ago

This only happens sporadically for me and committing the file fixes it.

cartazio commented 10 years ago

I just opened a pull request that fixes it :)

gornostal commented 10 years ago

Thanks @cartazio

@fobdy , @Rowno can you please confirm that cartazio's fix works for you?

Rowno commented 10 years ago

I can't reproduce the bug (it's happens pretty randomly), so it would be difficult to tell if it works.

Rowno commented 10 years ago

I ran into the bug again today. Applied the patch and it seems to have fixed it.

Rowno commented 10 years ago

I managed to reduce the bug to a single whitespace Unicode character that triggers it.

Copying this into Sublime Text will cause it: /‎"

Here's what the Git diff looks like:

-                        <a href="">Financial institutions</a>
+                        <a href="/financial-institutions/<U+200E>">Financial institutions</a>
gornostal commented 10 years ago

Thanks a lot, @cartazio. Your fix works! I finally got chance to verify it on OS X.

cartazio commented 10 years ago

WOOT