Home Download Buy Blog Forum Support

unicode & sys.path

Re: unicode & sys.path

Postby C0D312 on Wed Feb 01, 2012 3:28 am

@castles:
I could see why you decided not to explain all that in the beginning. It makes _so_ much sense from just looking at sesame street characters. :P
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: unicode & sys.path

Postby sublimator on Wed Feb 01, 2012 6:54 am

C0D312 wrote:I could see why you decided not to explain all that in the beginning. It makes _so_ much sense from just looking at sesame street characters. :P


haha But seriously, shit's so much easier when it's easier :)
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 648
Joined: Thu Mar 20, 2008 5:41 am

Re: unicode & sys.path

Postby sublimator on Wed Feb 01, 2012 8:59 am

Image
Count von Count wrote:Of 3038 users only 31 have non ascii paths.. All of them are importable (GetShortPathNameW on windows)
Last edited by sublimator on Thu Feb 02, 2012 9:28 am, edited 1 time in total.
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 648
Joined: Thu Mar 20, 2008 5:41 am

Re: unicode & sys.path

Postby wbond on Thu Feb 02, 2012 2:57 am

From what I can tell you added code to zencoding that reports statistics about users and their sublime.packages_path() to see if it is feasible for Jon to change the package system to use python packages instead of importing files from the current directory.
wbond
 
Posts: 493
Joined: Mon Feb 28, 2011 5:33 am

Re: unicode & sys.path

Postby sublimator on Thu Feb 02, 2012 6:49 am

Yep, inspired by Package Control, I wonder what it itself would have to say.

Code: Select all
import sublime

WINDOWS = sublime.platform() == 'windows'
if WINDOWS: from ctypes import windll, create_unicode_buffer

def importable_path(unicode_file_name):
    try:
        if WINDOWS: unicode_file_name.encode('ascii')
        return unicode_file_name
    except UnicodeEncodeError:
        buf = create_unicode_buffer(512)
        return( buf.value if (
                windll.kernel32
                      .GetShortPathNameW(unicode_file_name, buf, len(buf)) )
                else False )
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 648
Joined: Thu Mar 20, 2008 5:41 am

Previous

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 6 guests