Sky Explorer Supports Unicode Filename
Posted by sky | Tags: Mobile, Nokia, Open-Source, Python, Sky-Explorer, unicode
Unicode filename and path are supported in version 1.0.3 The symbian python os functions can accept utf8 string and will also return utf8 string (eg. in os.listdir). It does not use unicode string like in other native symbian functions. Since the Sky Explorer code uses path.join to get the full path in a lot of places, I modified path.join to always return in utf8 string regardless of its input. In places that use python os functions, no other changes are needed to allow for unicode filename and path. In places that use native symbian functions which expect unicode string, a conversion from utf8 string to unicode string is needed. -- unicode(fname, 'utf8')It will now support searching for unicode filename and can also search for unicode text in utf16 files. Zip and unzip can support unicode filename and path, this is done by encoding the unicode filename in utf8. Though if you unzip such a zip file in windows OS, the filename and path will remain in utf8 string. Unicode sms is supported using messaging.sms_send(to, msg, 'UCS2') Application tagging in unicode is also saved and restored correctly in the new version. (The source codes are released in http://skyexplorer.googlecode.com/svn/trunk/ ) Feb 12, Download from http://skyexplorer.googlecode.com/svn/trunk/sis/skyexplorer_2ndEd_1.0.3.sis or http://skyexplorer.googlecode.com/files/skyexplorer_2ndEd_1.0.3.sis. (We're sorry page) Previous Post Next Post(in dir_util.py) # this replaces os.path.join (encode p in utf8) os_path_join = path.join def path_join(a, *p): return os_path_join((a and type(a) is unicode) and a.encode('utf8') or a, *[(type(d) is unicode) and d.encode('utf8') or d for d in p]) if path.join is not path_join: path.join = path_join