-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch QGIS Qt6 overlay to fix project load containing bad characters
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
diff --git a/src/core/project/qgsproject.cpp b/src/core/project/qgsproject.cpp | ||
index 583c093c0ba..af332bf3036 100644 | ||
--- a/src/core/project/qgsproject.cpp | ||
+++ b/src/core/project/qgsproject.cpp | ||
@@ -1831,19 +1831,30 @@ bool QgsProject::readProjectFile( const QString &filename, Qgis::ProjectReadFlag | ||
return false; | ||
} | ||
|
||
+ QTextStream textStream( &projectFile ); | ||
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) | ||
+ textStream.setCodec( "UTF-8" ); | ||
+#endif | ||
+ QString projectString = textStream.readAll(); | ||
+ projectFile.close(); | ||
+ | ||
+ for ( int i = 0; i < 32; i++ ) | ||
+ { | ||
+ if ( i == 9 || i == 10 || i == 13 ) | ||
+ { | ||
+ continue; | ||
+ } | ||
+ projectString.remove( QChar( i ) ); | ||
+ } | ||
+ | ||
// location of problem associated with errorMsg | ||
int line, column; | ||
QString errorMsg; | ||
- | ||
- if ( !doc->setContent( &projectFile, &errorMsg, &line, &column ) ) | ||
+ if ( !doc->setContent( projectString, &errorMsg, &line, &column ) ) | ||
{ | ||
const QString errorString = tr( "Project file read error in file %1: %2 at line %3 column %4" ) | ||
.arg( projectFile.fileName(), errorMsg ).arg( line ).arg( column ); | ||
- | ||
QgsDebugError( errorString ); | ||
- | ||
- projectFile.close(); | ||
- | ||
setError( errorString ); | ||
|
||
return false; |