Allow for non-ascii text in resources
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -38,6 +38,7 @@ import wx.xrc
 | 
			
		||||
class PythonTemplates:
 | 
			
		||||
    FILE_HEADER = """\
 | 
			
		||||
# This file was automatically generated by pywxrc, do not edit by hand.
 | 
			
		||||
# -*- coding: UTF-8 -*-
 | 
			
		||||
 | 
			
		||||
import wx
 | 
			
		||||
import wx.xrc as xrc
 | 
			
		||||
@@ -153,14 +154,23 @@ class XmlResourceCompiler:
 | 
			
		||||
                
 | 
			
		||||
        # now write it all out
 | 
			
		||||
        print >>outputFile, self.templates.FILE_HEADER
 | 
			
		||||
        print >>outputFile, "\n".join(classes)
 | 
			
		||||
 | 
			
		||||
        # Note: Technically it is not legal to have anything other
 | 
			
		||||
        # than ascii for class and variable names, but since the user
 | 
			
		||||
        # can create the XML with non-ascii names we'll go ahead and
 | 
			
		||||
        # allow for it here, and then let Python complain about it
 | 
			
		||||
        # later when they try to run the program.
 | 
			
		||||
        classes = u"\n".join(classes)
 | 
			
		||||
        print >>outputFile, classes.encode("UTF-8")
 | 
			
		||||
 | 
			
		||||
        print >>outputFile, self.templates.INIT_RESOURE_HEADER
 | 
			
		||||
        if embedResources:
 | 
			
		||||
            print >>outputFile, self.templates.PREPARE_MEMFS
 | 
			
		||||
        print >>outputFile, "\n".join(resources)
 | 
			
		||||
        resources = u"\n".join(resources)
 | 
			
		||||
        print >>outputFile, resources.encode("UTF-8")
 | 
			
		||||
 | 
			
		||||
        if generateGetText:
 | 
			
		||||
            # These have already been converted to utf-8...
 | 
			
		||||
            gettextStrings = ['    _("%s")' % s for s in gettextStrings]
 | 
			
		||||
            gettextStrings = "\n".join(gettextStrings)
 | 
			
		||||
            print >>outputFile, self.templates.GETTEXT_DUMMY_FUNC % gettextStrings
 | 
			
		||||
@@ -424,7 +434,7 @@ class XmlResourceCompiler:
 | 
			
		||||
            else:            
 | 
			
		||||
                st2 += dt[i]
 | 
			
		||||
 | 
			
		||||
        return st2                
 | 
			
		||||
        return st2.encode("UTF-8")                
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    #-------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user