diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js index e662e43617..02bbde1c4c 100644 --- a/lib/OpenLayers/Format/XML.js +++ b/lib/OpenLayers/Format/XML.js @@ -493,8 +493,12 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { if(options.attributes) { this.setAttributes(node, options.attributes); } - if(options.value != null) { - node.appendChild(this.createTextNode(options.value)); + var value = options.value; + if(value != null) { + if(typeof value == "boolean") { + value = encodeURIComponent(value); + } + node.appendChild(this.createTextNode(value)); } return node; }, diff --git a/tests/Format/XML.html b/tests/Format/XML.html index b3bdd9385d..24a3952a11 100644 --- a/tests/Format/XML.html +++ b/tests/Format/XML.html @@ -595,6 +595,10 @@ description: "value of 0 gets appended as a text node", node: format.createElementNSPlus("foo:bar", {value: 0}), expect: "0" + }, { + description: "value of true gets appended as a text node", + node: format.createElementNSPlus("foo:bar", {value: true}), + expect: "true" }, { description: "value of false gets appended as a text node", node: format.createElementNSPlus("foo:bar", {value: false}),