Skip to content

Commit

Permalink
Merge pull request #272 from ahmdthr/encoding-issues-fix
Browse files Browse the repository at this point in the history
Fixed encoding issues for characters with umlaut
  • Loading branch information
giohappy authored Oct 30, 2024
2 parents 9ca8c3f + 83866fa commit aa3766b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/qgis_geonode/styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ def serialize_sld_named_layer(sld_named_layer: QtXml.QDomElement) -> str:
buffer_ = QtCore.QByteArray()
stream = QtCore.QTextStream(buffer_)
sld_named_layer.save(stream, 0)
return buffer_.data().decode(encoding="utf-8")
element_string = ""
try:
element_string = buffer_.data().decode(encoding="utf-8")
except UnicodeDecodeError:
element_string = buffer_.data().decode(encoding="latin-1")
return element_string


def get_usable_sld(
Expand Down

0 comments on commit aa3766b

Please sign in to comment.