<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,4 @@
+import misc
 import util
 
 from wxPython.wx import *
@@ -87,7 +88,7 @@ class AutoCompletionDlg(wxDialog):
         # but I don't want to call that since it does all types, this does
         # just the changed one.
         tmp = []
-        for v in self.itemsEntry.GetValue().split(&quot;\n&quot;):
+        for v in misc.fromGUI(self.itemsEntry.GetValue()).split(&quot;\n&quot;):
             v = util.toInputStr(v).strip()
 
             if len(v) &gt; 0:</diff>
      <filename>autocompletiondlg.py</filename>
    </modified>
    <modified>
      <diff>@@ -121,20 +121,15 @@ class GlobalData:
         self.makeConfDir()
 
     def makeConfDir(self):
-        makeDir = False
-
-        try:
-            os.stat(misc.confPath)
-        except OSError:
-            makeDir = True
+        makeDir = not util.fileExists(misc.confPath)
 
         if makeDir:
             try:
-                os.mkdir(misc.confPath, 0755)
+                os.mkdir(misc.toPath(misc.confPath), 0755)
             except OSError, (errno, strerror):
                 wxMessageBox(&quot;Error creating configuration directory\n&quot;
-                             &quot;'%s': %s&quot; % (misc.confPath, strerror), &quot;Error&quot;,
-                             wxOK, None)
+                             &quot;'%s': %s&quot; % (misc.toGUIUnicode(misc.confPath),
+                                           strerror), &quot;Error&quot;, wxOK, None)
 
     # set viewmode, the parameter is one of the VIEWMODE_ defines.
     def setViewMode(self, viewMode):
@@ -322,7 +317,7 @@ class MyCtrl(wxControl):
         if fileName:
             self.setDisplayName(os.path.basename(fileName))
         else:
-            self.setDisplayName(&quot;untitled&quot;)
+            self.setDisplayName(u&quot;untitled&quot;)
 
         self.setTabText()
         mainFrame.setTitle(self.fileNameDisplay)
@@ -823,8 +818,8 @@ class MyCtrl(wxControl):
             if wxTheClipboard.IsSupported(df):
                 data = wxTextDataObject()
                 wxTheClipboard.GetData(data)
-                s = data.GetText()
-                
+                s = misc.fromGUI(data.GetText())
+
             wxTheClipboard.Close()
 
         s = util.fixNL(s)
@@ -1042,15 +1037,16 @@ class MyCtrl(wxControl):
             dFile = os.path.basename(self.fileName)
         else:
             dDir = misc.scriptDir
-            dFile = &quot;&quot;
-    
+            dFile = u&quot;&quot;
+
         dlg = wxFileDialog(mainFrame, &quot;Filename to save as&quot;,
-            defaultDir = dDir, defaultFile = dFile,
+            defaultDir = misc.toGUIUnicode(dDir),
+            defaultFile = misc.toGUIUnicode(dFile),
             wildcard = &quot;Blyte files (*.blyte)|*.blyte|All files|*&quot;,
             style = wxSAVE | wxOVERWRITE_PROMPT)
         if dlg.ShowModal() == wxID_OK:
-            if self.saveFile(dlg.GetPath()):
-                gd.mru.add(dlg.GetPath())
+            if self.saveFile(misc.fromGUIUnicode(dlg.GetPath())):
+                gd.mru.add(misc.fromGUIUnicode(dlg.GetPath()))
 
         dlg.Destroy()
 
@@ -1060,12 +1056,12 @@ class MyCtrl(wxControl):
             return
         
         dlg = wxFileDialog(mainFrame, &quot;Filename to export as&quot;,
-            misc.scriptDir,
+            misc.toGUIUnicode(misc.scriptDir),
             wildcard = &quot;PDF|*.pdf|RTF|*.rtf|Formatted text|*.txt&quot;,
             style = wxSAVE | wxOVERWRITE_PROMPT)
 
         if dlg.ShowModal() == wxID_OK:
-            misc.scriptDir = dlg.GetDirectory()
+            misc.scriptDir = misc.fromGUIUnicode(dlg.GetDirectory())
 
             choice = dlg.GetFilterIndex()
             if choice == 0:
@@ -1076,7 +1072,8 @@ class MyCtrl(wxControl):
                 data = self.getExportText(sp)
 
             if data:
-                util.writeToFile(dlg.GetPath(), data, mainFrame)
+                util.writeToFile(misc.fromGUIUnicode(dlg.GetPath()), data,
+                                 mainFrame)
 
         dlg.Destroy()
 
@@ -1214,7 +1211,7 @@ class MyCtrl(wxControl):
             cs.char = chr(kc)
 
             if opts.isTest and (cs.char == &quot;&#229;&quot;):
-                self.loadFile(&quot;sample.blyte&quot;)
+                self.loadFile(u&quot;sample.blyte&quot;)
             elif opts.isTest and (cs.char == &quot;&#164;&quot;):
                 self.cmdTest(cs)
             else:
@@ -1857,12 +1854,12 @@ class MyFrame(wxFrame):
         return newPanel
 
     def setTitle(self, text):
-        self.SetTitle(&quot;Blyte - %s&quot; % text)
+        self.SetTitle(&quot;Blyte - %s&quot; % misc.toGUIUnicode(text))
 
     def setTabText(self, panel, text):
         i = self.findPage(panel)
         if i != -1:
-            self.notebook.SetPageText(i, text)
+            self.notebook.SetPageText(i, misc.toGUIUnicode(text))
     
     # notebook.GetSelection() returns invalid values, eg. it can return 1
     # when there is only one tab in existence, so it can't be relied on.
@@ -1962,13 +1959,14 @@ class MyFrame(wxFrame):
         self.openScript(gd.mru.get(i))
 
     def OnOpen(self, event = None):
-        dlg = wxFileDialog(self, &quot;File to open&quot;, misc.scriptDir,
+        dlg = wxFileDialog(self, &quot;File to open&quot;,
+            misc.toGUIUnicode(misc.scriptDir),
             wildcard = &quot;Blyte files (*.blyte)|*.blyte|All files|*&quot;,
             style = wxOPEN)
         
         if dlg.ShowModal() == wxID_OK:
-            misc.scriptDir = dlg.GetDirectory()
-            self.openScript(dlg.GetPath())
+            misc.scriptDir = misc.fromGUIUnicode(dlg.GetDirectory())
+            self.openScript(misc.fromGUIUnicode(dlg.GetPath()))
 
         dlg.Destroy()
 
@@ -1979,18 +1977,19 @@ class MyFrame(wxFrame):
         self.panel.ctrl.OnSaveScriptAs()
 
     def OnImportScript(self, event = None):
-        dlg = wxFileDialog(self, &quot;File to import&quot;, misc.scriptDir,
+        dlg = wxFileDialog(self, &quot;File to import&quot;,
+            misc.toGUIUnicode(misc.scriptDir),
             wildcard = &quot;Text files (*.txt)|*.txt|All files|*&quot;,
             style = wxOPEN)
         
         if dlg.ShowModal() == wxID_OK:
-            misc.scriptDir = dlg.GetDirectory()
+            misc.scriptDir = misc.fromGUIUnicode(dlg.GetDirectory())
 
             if not self.notebook.GetPage(self.findPage(self.panel))\
                    .ctrl.isUntouched():
                 self.panel = self.createNewPanel()
 
-            self.panel.ctrl.importFile(dlg.GetPath())
+            self.panel.ctrl.importFile(misc.fromGUIUnicode(dlg.GetPath()))
             self.panel.ctrl.updateScreen()
 
         dlg.Destroy()
@@ -2019,18 +2018,18 @@ class MyFrame(wxFrame):
 
     def OnLoadSettings(self, event = None):
         dlg = wxFileDialog(self, &quot;File to open&quot;,
-            defaultDir = os.path.dirname(gd.confFilename),
-            defaultFile = os.path.basename(gd.confFilename),
+            defaultDir = misc.toGUIUnicode(os.path.dirname(gd.confFilename)),
+            defaultFile = misc.toGUIUnicode(os.path.basename(gd.confFilename)),
             wildcard = &quot;Setting files (*.conf)|*.conf|All files|*&quot;,
             style = wxOPEN)
 
         if dlg.ShowModal() == wxID_OK:
-            s = util.loadFile(dlg.GetPath(), self)
+            s = util.loadFile(misc.fromGUIUnicode(dlg.GetPath()), self)
 
             if s:
                 c = config.ConfigGlobal()
                 c.load(s)
-                gd.confFilename = dlg.GetPath()
+                gd.confFilename = misc.fromGUIUnicode(dlg.GetPath())
                 
                 self.panel.ctrl.applyGlobalCfg(c, False)
 
@@ -2038,14 +2037,15 @@ class MyFrame(wxFrame):
 
     def OnSaveSettingsAs(self, event = None):
         dlg = wxFileDialog(self, &quot;Filename to save as&quot;,
-            defaultDir = os.path.dirname(gd.confFilename),
-            defaultFile = os.path.basename(gd.confFilename),
+            defaultDir = misc.toGUIUnicode(os.path.dirname(gd.confFilename)),
+            defaultFile = misc.toGUIUnicode(os.path.basename(gd.confFilename)),
             wildcard = &quot;Setting files (*.conf)|*.conf|All files|*&quot;,
             style = wxSAVE | wxOVERWRITE_PROMPT)
 
         if dlg.ShowModal() == wxID_OK:
-            if util.writeToFile(dlg.GetPath(), cfgGl.save(), self):
-                gd.confFilename = dlg.GetPath()
+            if util.writeToFile(misc.fromGUIUnicode(dlg.GetPath()),
+                                cfgGl.save(), self):
+                gd.confFilename = misc.fromGUIUnicode(dlg.GetPath())
             
         dlg.Destroy()
 
@@ -2166,12 +2166,12 @@ class MyFrame(wxFrame):
 
     def OnLoadScriptSettings(self, event = None):
         dlg = wxFileDialog(self, &quot;File to open&quot;,
-            defaultDir = gd.scriptSettingsPath,
+            defaultDir = misc.toGUIUnicode(gd.scriptSettingsPath),
             wildcard = &quot;Script setting files (*.sconf)|*.sconf|All files|*&quot;,
             style = wxOPEN)
 
         if dlg.ShowModal() == wxID_OK:
-            s = util.loadFile(dlg.GetPath(), self)
+            s = util.loadFile(misc.fromGUIUnicode(dlg.GetPath()), self)
 
             if s:
                 self.panel.ctrl.sp.loadCfg(s)
@@ -2179,20 +2179,22 @@ class MyFrame(wxFrame):
                 # kinda hacky, but very simple and works
                 self.panel.ctrl.applyCfg(self.panel.ctrl.sp.cfg)
                 
-                gd.scriptSettingsPath = os.path.dirname(dlg.GetPath())
+                gd.scriptSettingsPath = os.path.dirname(
+                    misc.fromGUIUnicode(dlg.GetPath()))
 
         dlg.Destroy()
 
     def OnSaveScriptSettingsAs(self, event = None):
         dlg = wxFileDialog(self, &quot;Filename to save as&quot;,
-            defaultDir = gd.scriptSettingsPath,
+            defaultDir = misc.toGUIUnicode(gd.scriptSettingsPath),
             wildcard = &quot;Script setting files (*.sconf)|*.sconf|All files|*&quot;,
             style = wxSAVE | wxOVERWRITE_PROMPT)
 
         if dlg.ShowModal() == wxID_OK:
-            if util.writeToFile(dlg.GetPath(),
+            if util.writeToFile(misc.fromGUIUnicode(dlg.GetPath()),
                                 self.panel.ctrl.sp.saveCfg(), self):
-                gd.scriptSettingsPath = os.path.dirname(dlg.GetPath())
+                gd.scriptSettingsPath = os.path.dirname(
+                    misc.fromGUIUnicode(dlg.GetPath()))
             
         dlg.Destroy()
 
@@ -2219,12 +2221,12 @@ class MyFrame(wxFrame):
             self.statusBar.SetStatusText(&quot;Opening name database...&quot;, 1)
             wxSafeYield()
             wxBeginBusyCursor()
-            self.names = decode.readNames(&quot;names.dat&quot;)
+            self.names = decode.readNames(u&quot;names.dat&quot;)
             wxEndBusyCursor()
             self.panel.ctrl.updateCommon()
 
             if self.names.count == 0:
-                wxMessageBox(&quot;Error opening name database&quot;, &quot;Error&quot;,
+                wxMessageBox(&quot;Error opening name database.&quot;, &quot;Error&quot;,
                              wxOK, self)
                 del self.names
 
@@ -2271,7 +2273,7 @@ class MyFrame(wxFrame):
             style = wxOPEN)
         
         if dlg.ShowModal() == wxID_OK:
-            data = util.loadFile(dlg.GetPath(), self)
+            data = util.loadFile(misc.fromGUIUnicode(dlg.GetPath()), self)
 
             if data != None:
                 self.setLicense(data, self, False);
@@ -2370,6 +2372,12 @@ class MyApp(wxApp):
                          &quot;Error&quot;, wxOK)
             sys.exit()
 
+        if misc.wx26:
+            # by setting this, we don't have to convert from 8-bit strings
+            # to Unicode ourselves everywhere when we pass them to
+            # wxWidgets.
+            wxSetDefaultPyEncoding(&quot;ISO-8859-1&quot;)
+
         os.chdir(misc.progPath)
         
         cfgGl = config.ConfigGlobal()</diff>
      <filename>blyte.py</filename>
    </modified>
    <modified>
      <diff>@@ -86,4 +86,4 @@ class BugReportDlg(wxDialog):
             self.brh.copyPos = len(self.brh.data)
             s = str(self.brh.data).encode(&quot;base64&quot;).encode(&quot;rot13&quot;)
             
-            util.writeToFile(dlg.GetPath(), s, self)
+            util.writeToFile(misc.fromGUIUnicode(dlg.GetPath()), s, self)</diff>
      <filename>bugreport.py</filename>
    </modified>
    <modified>
      <diff>@@ -1031,9 +1031,10 @@ class MiscPanel(wxPanel):
         event.Skip()
 
     def OnMisc(self, event = None):
-        self.cfg.scriptDir = self.scriptDirEntry.GetValue().rstrip(&quot;/\\&quot;)
-        self.cfg.pdfViewerPath = self.progEntry.GetValue()
-        self.cfg.pdfViewerArgs = self.argsEntry.GetValue()
+        self.cfg.scriptDir = misc.fromGUIUnicode(
+            self.scriptDirEntry.GetValue()).rstrip(&quot;/\\&quot;)
+        self.cfg.pdfViewerPath = misc.fromGUIUnicode(self.progEntry.GetValue())
+        self.cfg.pdfViewerArgs = misc.fromGUI(self.argsEntry.GetValue())
         self.cfg.capitalize = self.autoCapSentences.GetValue()
         self.cfg.capitalizeI = self.autoCapI.GetValue()
         self.cfg.honorSavedPos = self.honorSavedPos.GetValue()
@@ -1043,8 +1044,9 @@ class MiscPanel(wxPanel):
         self.cfg.mouseWheelLines = util.getSpinValue(self.wheelScrollEntry)
 
     def OnBrowse(self, event):
-        dlg = wxDirDialog(cfgFrame, defaultPath = self.cfg.scriptDir,
-                          style = wxDD_NEW_DIR_BUTTON)
+        dlg = wxDirDialog(cfgFrame,
+            defaultPath = misc.toGUIUnicode(self.cfg.scriptDir),
+            style = wxDD_NEW_DIR_BUTTON)
 
         if dlg.ShowModal() == wxID_OK:
             self.scriptDirEntry.SetValue(dlg.GetPath())
@@ -1053,8 +1055,8 @@ class MiscPanel(wxPanel):
             
     def OnBrowsePDF(self, event):
         dlg = wxFileDialog(cfgFrame, &quot;Choose program&quot;,
-            os.path.dirname(self.cfg.pdfViewerPath), self.cfg.pdfViewerPath,
-            style = wxOPEN)
+            misc.toGUIUnicode(os.path.dirname(self.cfg.pdfViewerPath)),
+            misc.toGUIUnicode(self.cfg.pdfViewerPath), style = wxOPEN)
 
         if dlg.ShowModal() == wxID_OK:
             self.progEntry.SetValue(dlg.GetPath())
@@ -1067,8 +1069,8 @@ class MiscPanel(wxPanel):
         self.paginateEntry.SetValue(5)
         self.confDelEntry.SetValue(5)
 
-        self.scriptDirEntry.SetValue(self.cfg.scriptDir)
-        self.progEntry.SetValue(self.cfg.pdfViewerPath)
+        self.scriptDirEntry.SetValue(misc.toGUIUnicode(self.cfg.scriptDir))
+        self.progEntry.SetValue(misc.toGUIUnicode(self.cfg.pdfViewerPath))
         self.argsEntry.SetValue(self.cfg.pdfViewerArgs)
         self.autoCapSentences.SetValue(self.cfg.capitalize)
         self.autoCapI.SetValue(self.cfg.capitalizeI)
@@ -1198,7 +1200,7 @@ class StringsPanel(wxPanel):
 
     def OnMisc(self, event = None):
         for it in self.items:
-            setattr(self.cfg, it, getattr(self, it).GetValue())
+            setattr(self.cfg, it, misc.fromGUI(getattr(self, it).GetValue()))
 
     def cfg2gui(self):
         for it in self.items:</diff>
      <filename>cfgdlg.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
+import misc
 import util
 
 import xml.sax.saxutils as xss
@@ -84,6 +85,7 @@ R                      Replace
             style = wxSAVE | wxOVERWRITE_PROMPT)
 
         if dlg.ShowModal() == wxID_OK:
-            util.writeToFile(dlg.GetPath(), self.html, self)
+            util.writeToFile(misc.fromGUIUnicode(dlg.GetPath()), self.html,
+                             self)
             
         dlg.Destroy()</diff>
      <filename>commandsdlg.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
+import misc
 import namearray
 import array
 
@@ -140,7 +141,7 @@ def readNames(filename):
     names = namearray.NameArray()
     
     try:
-        f = open(filename, &quot;rb&quot;)
+        f = open(misc.toPath(filename), &quot;rb&quot;)
 
         try:
             data = f.read()</diff>
      <filename>decode.py</filename>
    </modified>
    <modified>
      <diff>@@ -143,8 +143,9 @@ class FindDlg(wxDialog):
     def saveState(self):
         self.getParams()
         
-        self.ctrl.findDlgFindText = self.findEntry.GetValue()
-        self.ctrl.findDlgReplaceText = self.replaceEntry.GetValue()
+        self.ctrl.findDlgFindText = misc.fromGUI(self.findEntry.GetValue())
+        self.ctrl.findDlgReplaceText = misc.fromGUI(
+            self.replaceEntry.GetValue())
         self.ctrl.findDlgMatchWholeWord = self.matchWhole
         self.ctrl.findDlgMatchCase = self.matchCase
         self.ctrl.findDlgDirUp = self.dirUp
@@ -241,7 +242,7 @@ class FindDlg(wxDialog):
         if not autoFind:
             self.getParams()
 
-        value = self.findEntry.GetValue()
+        value = misc.fromGUI(self.findEntry.GetValue())
         if not self.matchCase:
             value = util.upper(value)
 
@@ -359,7 +360,7 @@ class FindDlg(wxDialog):
             
     def OnReplace(self, event = None, autoFind = False):
         if self.ctrl.searchLine != -1:
-            value = util.toInputStr(self.replaceEntry.GetValue())
+            value = util.toInputStr(misc.fromGUI(self.replaceEntry.GetValue()))
             ls = self.ctrl.sp.lines
 
             ls[self.ctrl.searchLine].text = util.replace(</diff>
      <filename>finddlg.py</filename>
    </modified>
    <modified>
      <diff>@@ -291,7 +291,7 @@ class HeadersDlg(wxDialog):
 
         h = self.headers.hdrs[self.hdrIndex]
         
-        h.text = util.toInputStr(self.textEntry.GetValue())
+        h.text = util.toInputStr(misc.fromGUI(self.textEntry.GetValue()))
         self.stringsLb.SetString(self.hdrIndex, h.text)
         
         h.xoff = util.getSpinValue(self.xoffEntry)</diff>
      <filename>headersdlg.py</filename>
    </modified>
    <modified>
      <diff>@@ -51,6 +51,44 @@ def init(doWX = True):
     progPath = unicode(progPath, &quot;UTF-8&quot;)
     confPath = unicode(confPath, &quot;UTF-8&quot;)
 
+# convert s, which is returned from the wxWidgets GUI and is either an
+# Unicode string or a normal string, to a normal string.
+def fromGUI(s):
+    if not wxIsUnicode:
+        return s
+    else:
+        return s.encode(&quot;ISO-8859-1&quot;, &quot;ignore&quot;)
+
+# convert s, which is returned from the wxWidgets GUI and is either an
+# Unicode string or a normal string, to a Unicode string. since the only
+# thing we use full Unicode for is file/directory names, and those are
+# UTF-8 on UNIXes, we use that instead of ISO-8859-1 here.
+def fromGUIUnicode(s):
+    if wxIsUnicode:
+        return s
+    else:
+        return unicode(s, &quot;UTF-8&quot;, &quot;ignore&quot;)
+
+# convert s, which is an Unicode string, to a form suitable for passing to
+# wxWidgets for display. since the only thing we use full Unicode for is
+# file/directory names, and those are UTF-8 on UNIXes, we use that instead
+# of ISO-8859-1 here.
+def toGUIUnicode(s):
+    if wxIsUnicode:
+        return s
+    else:
+        return s.encode(&quot;UTF-8&quot;)
+
+# convert s, which is an Unicode string, to an object suitable for passing
+# to Python's file APIs. this is either the Unicode string itself, if the
+# platform supports Unicode-based APIs (and Python has implemented support
+# for it), or the Unicode string converted to UTF-8 on other platforms.
+def toPath(s):
+    if unicodeFS:
+        return s
+    else:
+        return s.encode(&quot;UTF-8&quot;)
+
 class MyColorSample(wxWindow):
     def __init__(self, parent, id, size):
         wxWindow.__init__(self, parent, id, size = size)
@@ -393,7 +431,7 @@ class TextInputDlg(wxDialog):
             event.Skip()
 
     def OnOK(self, event = None):
-        self.input = self.tc.GetValue()
+        self.input = fromGUI(self.tc.GetValue())
 
         if self.validateFunc:
             msg = self.validateFunc(self.input)
@@ -439,13 +477,13 @@ class KeyDlgWidget(wxWindow):
         p.key = util.Key.fromKE(ev)
         p.EndModal(wxID_OK)
 
-# handles the &quot;Most recently used&quot; list of files in a menu. uses 
+# handles the &quot;Most recently used&quot; list of files in a menu.
 class MRUFiles:
     def __init__(self, maxCount):
         # max number of items
         self.maxCount = maxCount
 
-        # items (strings)
+        # items (Unicode strings)
         self.items = []
 
         for i in range(self.maxCount):
@@ -502,7 +540,8 @@ class MRUFiles:
         # add new menu items
         for i in range(self.getCount()):
             self.menu.Insert(self.menuPos + i, self.firstId + i,
-                             &quot;&amp;%d %s&quot; % (i + 1, os.path.basename(self.get(i))))
+                             &quot;&amp;%d %s&quot; % (
+                i + 1, toGUIUnicode(os.path.basename(self.get(i)))))
 
     # return number of items.
     def getCount(self):</diff>
      <filename>misc.py</filename>
    </modified>
    <modified>
      <diff>@@ -135,7 +135,7 @@ class NamesDlg(wxDialog):
 
         wxBeginBusyCursor()
         
-        s = util.lower(self.searchEntry.GetValue())
+        s = util.lower(misc.fromGUI(self.searchEntry.GetValue()))
         sex = self.sexRb.GetSelection()
         nt = self.nameRb.GetSelection()
 </diff>
      <filename>namesdlg.py</filename>
    </modified>
    <modified>
      <diff>@@ -22,7 +22,7 @@ def loadDict(frame):
         return True
 
     # use dict_en.dat if if exists, dict_en.dat.gz otherwise
-    fname = &quot;dict_en.dat&quot;
+    fname = u&quot;dict_en.dat&quot;
     doGz = False
     
     if not util.fileExists(fname):
@@ -44,7 +44,7 @@ def loadDict(frame):
             s = f.read()
         except:
             wxMessageBox(&quot;Error loading file '%s': Decompression failed&quot; % \
-                         fname, &quot;Error&quot;, wxOK, frame)
+                         misc.toGUIUnicode(fname), &quot;Error&quot;, wxOK, frame)
 
             return False
     </diff>
      <filename>spellcheck.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
+import misc
 import util
 
 from wxPython.wx import *
@@ -50,7 +51,7 @@ class SCDictDlg(wxDialog):
         self.EndModal(wxID_CANCEL)
 
     def OnMisc(self, event):
-        self.scDict.set(self.itemsEntry.GetValue().split(&quot;\n&quot;))
-                         
+        self.scDict.set(misc.fromGUI(self.itemsEntry.GetValue()).split(&quot;\n&quot;))
+
     def cfg2gui(self):
         self.itemsEntry.SetValue(&quot;\n&quot;.join(self.scDict.get()))</diff>
      <filename>spellcheckcfgdlg.py</filename>
    </modified>
    <modified>
      <diff>@@ -115,7 +115,7 @@ class SpellCheckDlg(wxDialog):
         if not self.sc.word:
             return
         
-        word = util.toInputStr(self.replaceEntry.GetValue())
+        word = util.toInputStr(misc.fromGUI(self.replaceEntry.GetValue()))
         ls = self.ctrl.sp.lines
 
         ls[self.sc.line].text = util.replace(</diff>
      <filename>spellcheckdlg.py</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,7 @@ class SplashWindow(wxFrame):
             SplashWindow.inited = True
             wxImage_AddHandler(wxJPEGHandler())
 
-        fileName = &quot;logo.jpg&quot;
+        fileName = u&quot;logo.jpg&quot;
         fileData = util.loadFile(fileName, parent)
 
         if not fileData or (len(fileData) != 130047) or \</diff>
      <filename>splash.py</filename>
    </modified>
    <modified>
      <diff>@@ -384,7 +384,7 @@ class TitlesDlg(wxDialog):
 
         ts = self.titles.pages[self.pageIndex][self.tsIndex]
         
-        ts.text = util.toInputStr(self.textEntry.GetValue())
+        ts.text = util.toInputStr(misc.fromGUI(self.textEntry.GetValue()))
         self.stringsLb.SetString(self.tsIndex, ts.text)
         
         ts.x = util.str2float(self.xEntry.GetValue(), 0.0)</diff>
      <filename>titlesdlg.py</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,7 @@ from error import *
 
 import datetime
 import glob
+import misc
 import os
 import re
 import sha
@@ -753,9 +754,9 @@ class String:
 # as parent on errors.
 def loadFile(filename, frame, maxSize = -1):
     ret = None
-    
+
     try:
-        f = open(filename, &quot;rb&quot;)
+        f = open(misc.toPath(filename), &quot;rb&quot;)
 
         try:
             ret = f.read(maxSize)
@@ -763,8 +764,8 @@ def loadFile(filename, frame, maxSize = -1):
             f.close()
 
     except IOError, (errno, strerror):
-        wxMessageBox(&quot;Error loading file '%s': %s&quot; % (filename, strerror),
-                     &quot;Error&quot;, wxOK, frame)
+        wxMessageBox(&quot;Error loading file '%s': %s&quot; % (
+            misc.toGUIUnicode(filename), strerror), &quot;Error&quot;, wxOK, frame)
         ret = None
 
     return ret
@@ -773,7 +774,7 @@ def loadFile(filename, frame, maxSize = -1):
 # parent on errors. returns True on success.
 def writeToFile(filename, data, frame):
     try:
-        f = open(filename, &quot;wb&quot;)
+        f = open(misc.toPath(filename), &quot;wb&quot;)
 
         try:
             f.write(data)
@@ -783,8 +784,8 @@ def writeToFile(filename, data, frame):
         return True
     
     except IOError, (errno, strerror):
-        wxMessageBox(&quot;Error writing file '%s': %s&quot; % (filename, strerror),
-                     &quot;Error&quot;, wxOK, frame)
+        wxMessageBox(&quot;Error writing file '%s': %s&quot; % (
+            misc.toGUIUnicode(filename), strerror), &quot;Error&quot;, wxOK, frame)
 
         return False
 
@@ -800,8 +801,7 @@ def removeTempFiles(prefix):
 # return True if given file exists.
 def fileExists(path):
     try:
-        # FIXME: unicode path handling
-        os.stat(path)
+        os.stat(misc.toPath(path))
     except OSError:
         return False
 </diff>
      <filename>util.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>522c926a278f69f57ebd8840395dad858f0be78b</id>
    </parent>
  </parents>
  <author>
    <name>Osku Salerma</name>
    <email>osku@iki.fi</email>
  </author>
  <url>http://github.com/oskusalerma/blyte/commit/c9ed51d41663bbe3992af724ff279757889b1712</url>
  <id>c9ed51d41663bbe3992af724ff279757889b1712</id>
  <committed-date>2006-03-05T09:05:37-08:00</committed-date>
  <authored-date>2006-03-05T09:05:37-08:00</authored-date>
  <message>Add support for Unicode builds of wxWidgets.

Add support for using Python's Unicode-versions of file APIs on platforms
that have those, and use UTF-8 for all filenames on other platforms.</message>
  <tree>dfcaaa9c3470a21b43478f9f616e96ed6ace8e66</tree>
  <committer>
    <name>Osku Salerma</name>
    <email>osku@iki.fi</email>
  </committer>
</commit>
