Detected wrong encoding and so saved [$50]

Bug #1100193 reported by Hlobil Vaclav
44
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Scratch
Fix Released
High
Robert Roth

Bug Description

Hi,

there's a critical (as it corrupts data) bug in Scratch. I have documents in Central European (WIN-1250) encoding. Scratch detects wrong encoding of this files while opening. There are some russian chars instead of czech ones. And as I change only one char in opened document, it is saved in that wrong encoding. And because there are not backups created on save, and autosave is activated in default state, it's very easy to lost correct version of document.

Maybe it's hard to detect right encoding or there is a problem in some related library, because some other editors (gedit...) detect wrong encoding too. But gedit has no autosave and also I can select right encoding in open file dialog.

Also sometimes Scratch opens empty file, when it's not in Latin-1 encoding.

Scratch isn't usable for me in this situations, so I'm forced to use gedit.

---

For testing, I created correct WIN-1250 document with some czech characters. It's in attachment. There's also screenshot showing how it should look.

Related branches

Revision history for this message
Hlobil Vaclav (vaclav-hlobil) wrote :
Revision history for this message
Hlobil Vaclav (vaclav-hlobil) wrote :
Revision history for this message
Hlobil Vaclav (vaclav-hlobil) wrote :

It's even worse than I thought. As I found out, file with wrong encoding is saved by Scratch immediately after opening. I don't have to write even a single char and file is saved. So the file data are already destroyed when you view it only. Look at next attachments.

Revision history for this message
Hlobil Vaclav (vaclav-hlobil) wrote :
Revision history for this message
Hlobil Vaclav (vaclav-hlobil) wrote :
Changed in scratch:
status: New → Confirmed
importance: Undecided → High
milestone: none → 1.2
Changed in scratch:
milestone: 2.0 → 2.1
Changed in scratch:
milestone: 2.0.1 → 2.1
Revision history for this message
Olivier Duchateau (duchateau-olivier) wrote :

This bug affects also FreeBSD users, when UTF-8 is not default encoding system. Personnaly I use this patch, which try to use current locale, and if it fails previous function.

Without this patch, Scratch can't open any files (my system use ISO-8859-15).

Cody Garver (codygarver)
Changed in scratch:
status: Confirmed → In Progress
Revision history for this message
Cody Garver (codygarver) wrote :

Olivier, your patch no longer applies cleanly, some work has been done to that area of the code. Do the changes resolve this issue? If not, can you provide an updated patch?

Changed in scratch:
status: In Progress → Incomplete
Revision history for this message
Robert Roth (evfool) wrote :

FYI: the changes in trunk did not resolve this issue, so this is still a valid issue.

Revision history for this message
quassy (quassy) wrote :

"And because there are not backups created on save, and autosave is activated in default state, it's very easy to lost correct version of document."
Regardless of the encoding problem discussed here, I think this does qualify as a bug alone. Any app should always present an undo option and that has to include the original unaltered file.

Robert Roth (evfool)
Changed in scratch:
status: Incomplete → Confirmed
Revision history for this message
Danielle Foré (danrabbit) wrote :
summary: - Detected wrong encoding and so saved
+ Detected wrong encoding and so saved [$50]
Robert Roth (evfool)
Changed in scratch:
assignee: nobody → Robert Roth (evfool)
status: Confirmed → In Progress
Cody Garver (codygarver)
Changed in scratch:
status: In Progress → Fix Committed
Changed in scratch:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.