[Scummvm-git-logs] scummvm master -> d7174806860b8b6f026028eb80e3a430b0ddc762

sev- noreply at scummvm.org
Wed Mar 18 15:33:23 UTC 2026


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
7bdaa6560f SLUDGE: Fix data file encoding and restore CP1252 compatibility
d717480686 SLUDGE: Add explanatory comment for UTF8 backward compatibility


Commit: 7bdaa6560fee56ae9f927e6af3ce09c828695f52
    https://github.com/scummvm/scummvm/commit/7bdaa6560fee56ae9f927e6af3ce09c828695f52
Author: Azzurra Suffia (azzurra.suffia at gmail.com)
Date: 2026-03-18T16:33:15+01:00

Commit Message:
SLUDGE: Fix data file encoding and restore CP1252 compatibility

The SLUDGE engine originally used CP1252 encoding for its data file
validation strings. During code conversion, this string was
accidentally transcoded to UTF-8 in the source code, causing ScummVM
to write headers that deviated from the original engine's format.

This change:

- Restores the original CP1252 validation string for all new writes.

- Implements a fallback to accept the UTF-8 validation string for
  backward compatibility with files created by previous ScummVM builds.

- Ensures consistency with the original SLUDGE data format.

Fix #13711

Changed paths:
    engines/sludge/savedata.cpp
    engines/sludge/savedata.h


diff --git a/engines/sludge/savedata.cpp b/engines/sludge/savedata.cpp
index c312dc8c5f7..c663f1d1e49 100644
--- a/engines/sludge/savedata.cpp
+++ b/engines/sludge/savedata.cpp
@@ -33,6 +33,7 @@
 namespace Sludge {
 
 const char CustomSaveHelper::UTF8_CHECKER[] = {'U', 'N', '\xef', '\xbf', '\xbd', 'L', 'O', '\xef', '\xbf', '\xbd', 'C', 'K', 'E', 'D', '\0'};
+const char CustomSaveHelper::CP1252_CHECKER[] = {'U', 'N', '\xA3', 'L', 'O', '\xE5', 'C', 'K', 'E', 'D', '\0'};;
 uint16 CustomSaveHelper::_saveEncoding = false;
 char CustomSaveHelper::_encode1 = 0;
 char CustomSaveHelper::_encode2 = 0;
@@ -131,7 +132,7 @@ bool CustomSaveHelper::fileToStack(const Common::String &filename, StackHandler
 
 	if (_saveEncoding) {
 		checker = readStringEncoded(fp);
-		if (checker != UTF8_CHECKER) {
+		if ((checker != CP1252_CHECKER) && (checker != UTF8_CHECKER)) {
 			delete fp;
 			return fatal(LOAD_ERROR "The current file encoding setting does not match the encoding setting used when this file was created:", filename);
 		}
@@ -201,7 +202,7 @@ bool CustomSaveHelper::stackToFile(const Common::String &filename, const Variabl
 
 	if (_saveEncoding) {
 		fp->writeString("[Custom data (encoded)]\r\n");
-		writeStringEncoded(UTF8_CHECKER, fp);
+		writeStringEncoded(CP1252_CHECKER, fp);
 	} else {
 		fp->writeString("[Custom data (ASCII)]\n");
 	}
diff --git a/engines/sludge/savedata.h b/engines/sludge/savedata.h
index e7c3fbe8659..2240f2a406e 100644
--- a/engines/sludge/savedata.h
+++ b/engines/sludge/savedata.h
@@ -35,6 +35,7 @@ public:
 
 private:
 	static const char UTF8_CHECKER[];
+	static const char CP1252_CHECKER[];
 	static char _encode1;
 	static char _encode2;
 


Commit: d7174806860b8b6f026028eb80e3a430b0ddc762
    https://github.com/scummvm/scummvm/commit/d7174806860b8b6f026028eb80e3a430b0ddc762
Author: Azzurra Suffia (azzurra.suffia at gmail.com)
Date: 2026-03-18T16:33:15+01:00

Commit Message:
SLUDGE: Add explanatory comment for UTF8 backward compatibility

Added the following comment before the validation string check:

// UTF8_CHECKER was written to files before March 2026
// due to a conversion error.
// For backward compatibility, we still accept UTF8_CHECKER
// when reading files.
// Files written after March 2026 use CP1252_CHECKER,
// the correct encoding.

Changed paths:
    engines/sludge/savedata.cpp


diff --git a/engines/sludge/savedata.cpp b/engines/sludge/savedata.cpp
index c663f1d1e49..e89e4f29caf 100644
--- a/engines/sludge/savedata.cpp
+++ b/engines/sludge/savedata.cpp
@@ -132,6 +132,10 @@ bool CustomSaveHelper::fileToStack(const Common::String &filename, StackHandler
 
 	if (_saveEncoding) {
 		checker = readStringEncoded(fp);
+
+		// ScummVM used UTF8_CHECKER when writing files before March 2026 due to a conversion error.
+		// For backward compatibility, we still accept UTF8_CHECKER when reading files.
+		// Files written after March 2026 use CP1252_CHECKER, the correct encoding.
 		if ((checker != CP1252_CHECKER) && (checker != UTF8_CHECKER)) {
 			delete fp;
 			return fatal(LOAD_ERROR "The current file encoding setting does not match the encoding setting used when this file was created:", filename);




More information about the Scummvm-git-logs mailing list