Skip to content

Commit

Permalink
Properly encode direction symbols in style templates (#6812)
Browse files Browse the repository at this point in the history
NOTE: this commit does NOT fix the project save operation,
      but only an output of that operation
  • Loading branch information
Sandro Santilli committed Dec 3, 2012
1 parent 1dc75f3 commit 9dd4a92
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -77,7 +77,7 @@
<property key="labeling/isExpression" value="false"/>
<property key="labeling/labelOffsetInMapUnits" value="true"/>
<property key="labeling/labelPerPart" value="false"/>
<property key="labeling/leftDirectionSymbol" value="< "/>
<property key="labeling/leftDirectionSymbol" value="&lt; "/>
<property key="labeling/mergeLines" value="false"/>
<property key="labeling/minFeatureSize" value="0"/>
<property key="labeling/multiLineLabels" value="false"/>
Expand All @@ -93,7 +93,7 @@
<property key="labeling/previewBkgrdColor" value="#ffffff"/>
<property key="labeling/priority" value="2"/>
<property key="labeling/reverseDirectionSymbol" value="false"/>
<property key="labeling/rightDirectionSymbol" value=" >"/>
<property key="labeling/rightDirectionSymbol" value=" &gt;"/>
<property key="labeling/scaleMax" value="0"/>
<property key="labeling/scaleMin" value="0"/>
<property key="labeling/textColorB" value="0"/>
Expand Down
Expand Up @@ -77,7 +77,7 @@
<property key="labeling/isExpression" value="false"/>
<property key="labeling/labelOffsetInMapUnits" value="true"/>
<property key="labeling/labelPerPart" value="false"/>
<property key="labeling/leftDirectionSymbol" value="< "/>
<property key="labeling/leftDirectionSymbol" value="&lt; "/>
<property key="labeling/mergeLines" value="false"/>
<property key="labeling/minFeatureSize" value="0"/>
<property key="labeling/multiLineLabels" value="false"/>
Expand All @@ -93,7 +93,7 @@
<property key="labeling/previewBkgrdColor" value="#ffffff"/>
<property key="labeling/priority" value="3"/>
<property key="labeling/reverseDirectionSymbol" value="true"/>
<property key="labeling/rightDirectionSymbol" value=" >"/>
<property key="labeling/rightDirectionSymbol" value=" &gt;"/>
<property key="labeling/scaleMax" value="0"/>
<property key="labeling/scaleMin" value="0"/>
<property key="labeling/textColorB" value="0"/>
Expand Down

2 comments on commit 9dd4a92

@dakcarto
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sandro,

Whoa! That's quite the oversight on my part. I should have time to fix the encoding of XML reserved characters later on this week (maybe Thursday). Swamped with work until then.

Do you think anymore than this needs done before writing?

data.replace(QRegExp("&"), "&amp;"); //first on write, last of read
data.replace(QRegExp("<"), "&lt;");
data.replace(QRegExp(">"), "&gt;");
data.replace(QRegExp("\""), "&quot;");
data.replace(QRegExp("'"), "&apos;");

Then reverse it on read.

For more exotic characters, I was entrusting the base UTF-8 encoding of the project file.

@strk
Copy link
Contributor

@strk strk commented on 9dd4a92 Dec 4, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it makes more sense to define an xmlEncode(data) function, if not already available. I'm surprised it's not automatic though, how is that handled by other parts of the project file values ? What if I name a layer "" ?

Please sign in to comment.