Windows: some files lead to "Couldn't encode text" on saving without any warnings during open (copy of mis-deleted issue 153)
Steps to reproduce:
- run meld on windows
use windows-1251 encoding to open the file cyrillic-with-capital-letter-i-utf8.txt
- Garbage is shown. Note that first visible symbol is 'Р' (0xD0) which is followed by invisible undecodable byte 0x98 than followed by space. Garbage is expected, but treating undecodable symbol as empty without warning is problematic.
Type a space and try to save.
- A modal dialog appears which tells that file contains characters not encodable in windows-1251 and suggests "Would you like to save as UTF-8?"
- the warning is either given during open (like in linux, see below)
- or save with current encoding is always possible
With this toy steps for reproduce it's obviously after step 2 that file is shown incorrectly. But in real-word cases for files with lot of ascii and a bit of non-ascii chars such saving error after performing edits is very unexpected.
This issue looks to be Windows-specific (but both with mingw64 gtk 3.22 and pygi-aio gtk 3.18 binaries) and both meld 3.18 and current master.
On linux there is better behaviour: after step 2 file is not shown with "invalid byte sequence" error (or shown with "replacement character" warning for some encodings if utf8 is selected foer non-utf8 file). But both cases avoids unexpectance of saving problems.