Home Download Buy Blog Forum Support

[bug] Build scripts don't work with unicode paths

[bug] Build scripts don't work with unicode paths

Postby wassuup on Tue Jun 05, 2012 8:26 pm

Hello.
I have already mentioned this here -> http://www.sublimetext.com/forum/viewtopic.php?f=3&t=7291 but as I'm sure now that this is a bug I thought I'd file a bug report.

Issue: Build scripts don't work on files which contain non-ascii characters.

Reproduce: create a file test.py. Past this code into it:
Code: Select all
print 'hello world!'

Press f7 and it'll print "hello world!" to the console.
Now, rename it to "tést.py", "täst.py" or anything else containing "strange" chars. When trying to build now, an error will show i the sublime console now:
Code: Select all
Traceback (most recent call last):
  File "./sublime_plugin.py", line 325, in run_
  File "./exec.py", line 124, in run
UnicodeEncodeError: [b]'ascii' codec can't encode character[/b] u'\xe9' in position 53: ordinal not in range(128)


This is quite annoying to me as german speaker as I often have umlauts in path names. It'd not be that much to fix it I guess just add some "u"s somewhere in the right place :P

Thanks
wassuup
 
Posts: 5
Joined: Thu May 24, 2012 7:45 pm

Re: [bug] Build scripts don't work with unicode paths

Postby bizoo on Tue Jun 05, 2012 9:42 pm

I suppose that the exec command must be modified with something like:
Code: Select all
class ExecCommand(sublime_plugin.WindowCommand, ProcessListener):
    def run(self, cmd = [], file_regex = "", line_regex = "", working_dir = "",
            encoding = "utf-8", env = {}, quiet = False, kill = False,
            # Catches "path" and "shell"
            **kwargs):
        cmd = [c.encode(sys.getfilesystemencoding()) for c in cmd]
        ...

At least it works that way on Windows 7, not sure for other OS.
bizoo
 
Posts: 888
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: [bug] Build scripts don't work with unicode paths

Postby wassuup on Wed Jun 06, 2012 11:25 am

Thanks very much. Works now under Linux, too. OSX should work then too, I guess.
wassuup
 
Posts: 5
Joined: Thu May 24, 2012 7:45 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 22 guests