I used latest WryeBash 292 with bEnableUnicode=True on Python 2.6.6, wxPython 2.8.12 (unicode) and Japanese Windows 7 SP1 (x64). I'll post report and the patch because encountered some problems.
When initial open installers tab.
Spoiler
Traceback (most recent call last):
File "D:\Oblivion\Mopy\basher.py", line 4737, in OnShowPage
self.GetPage(event.GetSelection()).OnShow()
File "D:\Oblivion\Mopy\basher.py", line 3238, in OnShow
self.gList.RefreshUI()
File "D:\Oblivion\Mopy\balt.py", line 1459, in RefreshUI
self.UpdateItems(selected=selected)
File "D:\Oblivion\Mopy\balt.py", line 1401, in UpdateItems
self.SortItems()
File "D:\Oblivion\Mopy\balt.py", line 1431, in SortItems
items = self.data.getSorted(column,reverse)
File "D:\Oblivion\Mopy\bosh.py", line 11963, in getSorted
items.sort()
File "D:\Oblivion\Mopy\bolt.py", line 637, in __cmp__
if isinstance(other,Path): return cmp(self._cs, other._cs)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8f in position 0: ordinal not in range(128)
Patch
Spoiler
--- a/Mopy/bolt.py
+++ b/Mopy/bolt.py
@@ -676,7 +676,11 @@ class Path(object):
def __hash__(self):
return hash(self._cs)
def __cmp__(self, other):
- if isinstance(other,Path): return cmp(self._cs, other._cs)
+ if isinstance(other,Path):
+ try:
+ return cmp(self._cs, other._cs)
+ except UnicodeDecodeError:
+ return cmp(Encode(self._cs), Encode(other._cs))
else: return cmp(self._cs, Path.getCase(other))
When show details of mod in the mods tab.
Spoiler
Traceback (most recent call last):
File "D:\Oblivion\Mopy\basher.py", line 11198, in Execute
progress = balt.Progress(_(modName.s))
File "D:\Oblivion\Mopy\bolt.py", line 121, in _
if encode: text = reEscQuote.sub("'",text.encode('string_escape'))
TypeError: escape_encode() argument 1 must be string, not unicode
Patch
Spoiler
--- a/Mopy/basher.py
+++ b/Mopy/basher.py
@@ -11195,7 +11195,7 @@ class Mod_Details(Link):
def Execute(self,event):
modName = GPath(self.data[0])
modInfo = bosh.modInfos[modName]
- progress = balt.Progress(_(modName.s))
+ progress = balt.Progress(modName.s)
try:
modDetails = bosh.ModDetails()
modDetails.readFromMod(modInfo,SubProgress(progress,0.1,0.7))
When open installers tab.
Spoiler
Traceback (most recent call last):
File "D:\Oblivion\Mopy\basher.py", line 7399, in Execute
gInstallers.OnShow()
File "D:\Oblivion\Mopy\basher.py", line 3237, in OnShow
if data.refresh(progress,what,self.fullRefresh):
File "D:\Oblivion\Mopy\bosh.py", line 11927, in refresh
if 'I' in what: changed |= self.refreshInstallers(progress,fullRefresh)
File "D:\Oblivion\Mopy\bosh.py", line 12126, in refreshInstallers
try: installer.refreshBasic(apath,SubProgress(progress,index,index+1))
File "D:\Oblivion\Mopy\bosh.py", line 10819, in refreshBasic
self.refreshSource(archive,progress,fullRefresh)
File "D:\Oblivion\Mopy\bosh.py", line 11381, in refreshSource
ins = listArchiveContents(archive.s)
File "D:\Oblivion\Mopy\bosh.py", line 118, in listArchiveContents
ins, err = Popen(command, stdout=PIPE, startupinfo=startupinfo).communicate()
File "C:\Python26\lib\subprocess.py", line 623, in __init__
errread, errwrite)
Patch
Spoiler
--- a/Mopy/bosh.py
+++ b/Mopy/bosh.py
@@ -115,6 +115,7 @@ configHelpers = None #--Config Helper files (Boss Master List, etc.)
def listArchiveContents(fileName):
command = r'"%s" l -slt "%s"' % (dirs['mopy'].join('7zUnicode.exe').s, fileName)
+ command = command.encode('mbcs')
ins, err = Popen(command, stdout=PIPE, startupinfo=startupinfo).communicate()
return ins
Filename passed to the shell should be locale-dependent encoding (For backward compatibility. of course, even NT/NTFS. Microsoft svcks:p). Also other place which run 7zUnicode.exe/attrib as a subprocess.
When install a package.
Spoiler
Traceback (most recent call last):
File "D:\Oblivion\Mopy\basher.py", line 8015, in Execute
self.data.install(self.filterInstallables(),progress,last,override)
File "D:\Oblivion\Mopy\bosh.py", line 12400, in install
installer.install(archive,destFiles,self.data_sizeCrcDate,SubProgress(progress,index,index+1))
File "D:\Oblivion\Mopy\bosh.py", line 11509, in install
self.unpackToTemp(archive,dest_src.values(),SubProgress(progress,0,0.9))
File "D:\Oblivion\Mopy\bosh.py", line 11481, in unpackToTemp
progress(index,_("%s\nExtracting files...\n%s") % (archive.s.encode('UTF8'), maExtracting.group(1).strip()))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 12: ordinal not in range(128)
Patch
Spoiler
--- a/Mopy/bosh.py
+++ b/Mopy/bosh.py
@@ -11476,7 +11478,7 @@ class InstallerArchive(Installer):
if maExtracting:
extracted.append(maExtracting.group(1).strip())
if bUseUnicode:
- progress(index,_("%s\nExtracting files...\n%s") % (archive.s.encode('UTF8'), maExtracting.group(1).strip()))
+ progress(index,_("%s\nExtracting files...\n%s") % (archive.s, maExtracting.group(1).strip()))
else:
progress(index,_("%s\nExtracting files...\n%s") % (archive.s, maExtracting.group(1).strip()))
index += 1
@@ -11487,7 +11489,7 @@ class InstallerArchive(Installer):
ins, err = Popen(cmd, stdout=PIPE, startupinfo=startupinfo).communicate()
if result:
if bUseUnicode:
- raise StateError(_("%s: Extraction failed\n%s") % (archive.s.encode('UTF8'),"\n".join(errorLine)))
+ raise StateError(_("%s: Extraction failed\n%s") % (archive.s,"\n".join(errorLine)))
else:
raise StateError(_("%s: Extraction failed\n%s") % (archive.s,"\n".join(errorLine)))
#--Done
When click savedata in saves tab.
Spoiler
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py", line 1358, in Notify
self.notify()
File "C:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 14762, in Notify
self.result = self.callable(*self.args, **self.kwargs)
File "D:\Oblivion\Mopy\basher.py", line 3018, in OnDropFiles
modList.RefreshUI()
File "D:\Oblivion\Mopy\basher.py", line 1532, in RefreshUI
saveList.RefreshUI()
File "D:\Oblivion\Mopy\basher.py", line 2409, in RefreshUI
saveDetails.SetFile(detail)
File "D:\Oblivion\Mopy\basher.py", line 2609, in SetFile
(self.playerNameStr,self.playerLevel,int(self.gameDays),self.playMinutes/60,(self.playMinutes % 60),self.curCellStr))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8c in position 0: ordinal not in range(128)
Patch
Spoiler
--- a/Mopy/basher.py
+++ b/Mopy/basher.py
@@ -2605,8 +2605,14 @@ class SaveDetails(wx.Window):
self.coSaves = '%s\n%s' % saveInfo.coSaves().getTags()
#--Set Fields
self.file.SetValue(self.fileStr)
- self.playerInfo.SetLabel(_("%s\nLevel %d, Day %d, Play %d:%02d\n%s") %
- (self.playerNameStr,self.playerLevel,int(self.gameDays),self.playMinutes/60,(self.playMinutes % 60),self.curCellStr))
+ if bolt.bUseUnicode:
+ self.playerInfo.SetLabel(_("%s\nLevel %d, Day %d, Play %d:%02d\n%s") %
+ (self.playerNameStr.decode('mbcs'),
+ self.playerLevel,int(self.gameDays),self.playMinutes/60,(self.playMinutes % 60),
+ self.curCellStr.decode('mbcs')))
+ else:
+ self.playerInfo.SetLabel(_("%s\nLevel %d, Day %d, Play %d:%02d\n%s") %
+ (self.playerNameStr,self.playerLevel,int(self.gameDays),self.playMinutes/60,(self.playMinutes % 60),self.curCellStr))
self.gCoSaves.SetLabel(self.coSaves)
self.masters.SetFileInfo(saveInfo)
#--Picture
Should be decode a string obtained from savedata.
When open installers tab.
Spoiler
Traceback (most recent call last):
File "D:\Oblivion\Mopy\basher.py", line 4728, in OnShowPage
self.GetPage(event.GetSelection()).OnShow()
File "D:\Oblivion\Mopy\basher.py", line 3236, in OnShow
if data.refresh(progress,what,self.fullRefresh):
File "D:\Oblivion\Mopy\bosh.py", line 11922, in refresh
settings['bash.installers.removeEmptyDirs'], fullRefresh)
File "D:\Oblivion\Mopy\bosh.py", line 10459, in refreshSizeCrcDate
progress(0,_("%s\nCalculating CRCs...\n") % rootName)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x82 in position 6: ordinal not in range(128)
Patch
Spoiler
--- a/Mopy/bolt.py
+++ b/Mopy/bolt.py
@@ -123,6 +123,8 @@ if os.path.exists(languagePkl):
if core and core in _translator:
text = head+_translator[core]+tail
if encode: text = text.decode('string_escape')
+ if bUseUnicode: text = unicode(text,'mbcs')
return text
else:
def _(text,encode=True): return text
The translated message had better return as unicode.
When pack project to archive.
Spoiler
Traceback (most recent call last):
File "D:\Oblivion\Mopy\basher.py", line 8794, in Execute
installer.packToArchive(project,archive,isSolid,blockSize,SubProgress(progress,0,0.8))
File "D:\Oblivion\Mopy\bosh.py", line 11770, in packToArchive
progress(index,archive.s+_("\nCompressing files...\n%s") % maCompressing.group(1).strip())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
Patch
Spoiler
--- a/Mopy/bosh.py
+++ b/Mopy/bosh.py
@@ -11747,7 +11747,8 @@ class InstallerProject(Installer):
out.write('--*\\')
out.close()
#--Compress
- if bosh.inisettings['EnableUnicode']:
+ bUseUnicode = inisettings['EnableUnicode']
+ if bUseUnicode:
command = '"%s" a "%s" -t"%s" %s -y -r -o"%s" -i!"%s\\*" -x@%s -scsWIN' % (dirs['mopy'].join('7zUnicode.exe').s, outFile.temp.s, archiveType, solid, outDir.s, project.s, self.tempList.s)
command = command.encode('mbcs')
else:
@@ -11767,7 +11768,10 @@ class InstallerProject(Installer):
if len(errorLine) or regErrMatch(line):
errorLine.append(line)
if maCompressing:
- progress(index,archive.s+_("\nCompressing files...\n%s") % maCompressing.group(1).strip())
+ if bUseUnicode:
+ progress(index,archive.s+_("\nCompressing files...\n%s") % Unicode(maCompressing.group(1).strip()))
+ else:
+ progress(index,archive.s+_("\nCompressing files...\n%s") % maCompressing.group(1).strip())
index += 1
result = ins.close()
self.tempList.remove()
When delete installer project.
Spoiler
Traceback (most recent call last):
File "D:\Oblivion\Mopy\balt.py", line 1720, in Execute
self.gTank.DeleteSelected()
File "D:\Oblivion\Mopy\balt.py", line 1577, in DeleteSelected
del self.data[item]
File "D:\Oblivion\Mopy\bosh.py", line 12061, in __delitem__
apath.rmtree(safety='Installers')
File "D:\Oblivion\Mopy\bolt.py", line 625, in rmtree
ins, err = Popen(cmd, stdout=PIPE, startupinfo=startupinfo).communicate()
File "C:\Python26\lib\subprocess.py", line 623, in __init__
errread, errwrite)
File "C:\Python26\lib\subprocess.py", line 833, in _execute_child
startupinfo)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 44-48: ordinal not in range(128)
Patch
Spoiler
--- a/Mopy/bolt.py
+++ b/Mopy/bolt.py
@@ -622,6 +622,8 @@ class Path(object):
if self.isdir() and safety and safety.lower() in self._cs:
# Clear ReadOnly flag if set
cmd = r'attrib -R "%s\*" /S /D' % (self._s)
+ if bUseUnicode: cmd = cmd.encode('mbcs')
ins, err = Popen(cmd, stdout=PIPE, startupinfo=startupinfo).communicate()
shutil.rmtree(self._s)
When show list structure in installers tab.
Spoiler
Traceback (most recent call last):
File "C:\Oblivion\Mopy\basher.py", line 8086, in Execute
text = installer.listSource(archive)
File "C:\Oblivion\Mopy\bosh.py", line 11565, in listSource
log.setHeader(_(u'Package Structure:'))
File "C:\Oblivion\Mopy\bolt.py", line 121, in _
if encode: text = reEscQuote.sub("'",text.encode('string_escape'))
TypeError: escape_encode() argument 1 must be str, not unicode
Patch
Spoiler
--- a/Mopy/bolt.py
+++ b/Mopy/bolt.py
@@ -118,6 +118,7 @@ if os.path.exists(languagePkl):
_translator = cPickle.load(pklFile)
pklFile.close()
def _(text,encode=True):
+ if isinstance(text,unicode): text = Encode(text)
if encode: text = reEscQuote.sub("'",text.encode('string_escape'))
head,core,tail = reTrans.match(text).groups()
if core and core in _translator:
diff --git a/Mopy/bosh.py b/Mopy/bosh.py
index a4675a9..17ff664 100644
--- a/Mopy/bosh.py
+++ b/Mopy/bosh.py
@@ -11559,7 +11559,7 @@ class InstallerArchive(Installer):
log = bolt.LogFile(stringBuffer())
if bUseUnicode:
log.out.write(u'[spoiler]')
- log.setHeader(_(u'Package Structure:'))
+ log.setHeader(_('Package Structure:'))
reList = re.compile(u'(Solid|Path|Size|CRC|Attributes|Method) = (.*?)(?:\r\n|\n)')
file = u''
else:
It's fixed by applying either hunk, but just in case.
All patches are here.
https://github.com/valda/wryebash/compare/master...enable_unicode_topic
(Mopy/Data/Japanese.txt is work in progress. Skip please.)
The Unicode-Bash is a very significant improvement for non-English users. 292 becomes great release. Keep up the good work!
I'm sorry for big post and ugly engrish