Skip to content

Commit 5471d66

Browse files
committed
[BUGFIX] 13118 QGIS Server - WFS - GeoJSON and escaping line breaks
Line breaks are not properly handled in GeoJSON results when making GetFeature requests. Line breaks should be replaced by \\n.
1 parent 17378ba commit 5471d66

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/server/qgswfsserver.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,10 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, int prec, QgsCoord
17421742
else
17431743
{
17441744
fStr += "\"";
1745-
fStr += val.toString().replace( QString( "\"" ), QString( "\\\"" ) );
1745+
fStr += val.toString()
1746+
.replace( QString( "\"" ), QString( "\\\"" ) )
1747+
.replace( QString( "\r" ), QString( "\\r" ) )
1748+
.replace( QString( "\n" ), QString( "\\n" ) );
17461749
fStr += "\"";
17471750
}
17481751
fStr += "\n";

0 commit comments

Comments
 (0)