3190 txt, self.encoding = Utilities.readEncodedFileWithEncoding( |
3190 txt, self.encoding = Utilities.readEncodedFileWithEncoding( |
3191 fileName, encoding |
3191 fileName, encoding |
3192 ) |
3192 ) |
3193 else: |
3193 else: |
3194 txt, self.encoding = Utilities.readEncodedFile(fileName) |
3194 txt, self.encoding = Utilities.readEncodedFile(fileName) |
3195 except (UnicodeDecodeError, OSError) as why: |
3195 except (OSError, UnicodeDecodeError) as why: |
3196 EricMessageBox.critical( |
3196 EricMessageBox.critical( |
3197 self, |
3197 self, |
3198 self.tr("Open File"), |
3198 self.tr("Open File"), |
3199 self.tr( |
3199 self.tr( |
3200 "<p>The file <b>{0}</b> could not be opened.</p>" |
3200 "<p>The file <b>{0}</b> could not be opened.</p>" |
3300 "DefaultEncoding", nodefault=True, config=config |
3300 "DefaultEncoding", nodefault=True, config=config |
3301 ) |
3301 ) |
3302 self.encoding = Utilities.writeEncodedFile( |
3302 self.encoding = Utilities.writeEncodedFile( |
3303 fileName, txt, self.encoding, forcedEncoding=editorConfigEncoding |
3303 fileName, txt, self.encoding, forcedEncoding=editorConfigEncoding |
3304 ) |
3304 ) |
3305 except (OSError, Utilities.CodingError, UnicodeError) as why: |
3305 except (OSError, UnicodeError, Utilities.CodingError) as why: |
3306 EricMessageBox.critical( |
3306 EricMessageBox.critical( |
3307 self, |
3307 self, |
3308 self.tr("Save File"), |
3308 self.tr("Save File"), |
3309 self.tr( |
3309 self.tr( |
3310 "<p>The file <b>{0}</b> could not be saved.<br/>Reason: {1}</p>" |
3310 "<p>The file <b>{0}</b> could not be saved.<br/>Reason: {1}</p>" |