Created
November 6, 2013 13:55
-
-
Save alapolloni/7336422 to your computer and use it in GitHub Desktop.
for this discussion https://github.com/maebert/jrnl/pull/102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def u(s): | |
| """Mock unicode function for python 2 and 3 compatibility.""" | |
| """file paths with a U like uses directories in Windows where being interperted at Unicode so force converting to string""" | |
| """return s if PY3 or type(s) is unicode else unicode(s.encode('string-escape'), "unicode_escape")""" | |
| print("barf-debug:PY3",PY3) | |
| print ("type(s):",type(s)) | |
| print ("s:",s) | |
| print("what are we returning?") | |
| if PY3 or type(s) is unicode: | |
| print "return s" | |
| else: | |
| print "in the else" | |
| print r'return unicode(s, "unicode_escape")' | |
| #for i in range(60,66): print (i,s[i]) | |
| #for i in range(0,5): print (i,s[i]) | |
| for i in range(59,66): print (i,s[i],unicode(s[i]),ord(s[i])) | |
| print("barf-debug") | |
| #t= unicode(s.encode('string-escape'), "unicode_escape") | |
| #print ("T",t) | |
| #return s if PY3 or type(s) is unicode else unicode(t, "unicode_escape") | |
| return s if PY3 or type(s) is unicode else unicode(s, "unicode_escape") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment