Comment 3 for bug 139603

Revision history for this message
Colin Watson (cjwatson) wrote :

IMO this is a bug in xorgconfig.py. Note that in one place it does:

            try:
                loc = locale.getpreferredencoding()
            except locale.Error:
                loc = 'ANSI_X3.4-1968'

... while in the offending function it does:

    def writeConfig(self,filename):
        fhandle = codecs.open(filename,'w',locale.getpreferredencoding())
        fhandle.write(self.toString())
        fhandle.close()

I suggest this code instead to match the first segment I quoted:

    def writeConfig(self,filename):
        try:
            encoding = locale.getpreferredencoding()
        except locale.Error:
            encoding = 'ANSI_X3.4-1968'
        fhandle = codecs.open(filename,'w',encoding)
        fhandle.write(self.toString())
        fhandle.close()