Index: src/uk/me/parabola/mkgmap/reader/osm/Element.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/Element.java	(revision 3643)
+++ src/uk/me/parabola/mkgmap/reader/osm/Element.java	(working copy)
@@ -19,10 +19,16 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import uk.me.parabola.imgfmt.app.Label;
+import uk.me.parabola.log.Logger;
+
+
 /**
  * Superclass of the node, segment and way OSM elements.
  */
 public abstract class Element {
+	private static final Logger log = Logger.getLogger(Element.class);
+	
 	private Tags tags;
 	private long id;
 	private long originalId;
@@ -32,7 +38,30 @@
 	}
 	
 	/**
-	 * Add a tag to the way.  Some tags are recognised separately and saved in
+	 * Add a tag to the element. This method should be called by OSM readers
+	 * because it trims obsolete spaces from the value.
+	 *
+	 * @param key The tag name.
+	 * @param val Its value.
+	 */
+	public void addTagFromRawOSM(String key, String val) {
+		if (val != null){
+			val = val.trim();
+			if (val.isEmpty() == false){
+				// remove duplicated spaces within value
+				String squashed = Label.squashSpaces(val);
+				if (val.equals(squashed) == false) {
+					if (log.isInfoEnabled())
+						log.info(this.toBrowseURL(),"obsolete blanks removed from tag", key, " '" + val + "' -> '" + squashed + "'");
+					val = squashed;
+				}
+			}
+		}
+		addTag(key, val.intern());
+	}
+
+	/**
+	 * Add a tag to the element.  Some tags are recognised separately and saved in
 	 * separate fields.
 	 *
 	 * @param key The tag name.
@@ -45,7 +74,7 @@
 	}
 
 	/**
-	 * Add a tag to the way.  Some tags are recognised separately and saved in
+	 * Add a tag to the element.  Some tags are recognised separately and saved in
 	 * separate fields.
 	 *
 	 * @param tagKey The tag id created by TagDict
Index: src/uk/me/parabola/mkgmap/reader/osm/bin/OsmBinHandler.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/bin/OsmBinHandler.java	(revision 3643)
+++ src/uk/me/parabola/mkgmap/reader/osm/bin/OsmBinHandler.java	(working copy)
@@ -70,10 +70,10 @@
 					Node node = new Node(id, co);
 					for (int tid = 0; tid < tagCount; tid++) {
 						String key = getStringById(binNode.getKeys(tid));
-						String val = getStringById(binNode.getVals(tid)).trim();
+						String val = getStringById(binNode.getVals(tid));
 						key = keepTag(key, val);
 						if (key != null)
-							node.addTag(key, val.intern());
+							node.addTagFromRawOSM(key, val);
 					}
 
 					saver.addNode(node);
@@ -105,12 +105,12 @@
 						int keyid = nodes.getKeysVals(kvid++);
 						int valid = nodes.getKeysVals(kvid++);
 						String key = getStringById(keyid);
-						String val = getStringById(valid).trim();
+						String val = getStringById(valid);
 						key = keepTag(key, val);
 						if (key != null) {
 							if (node == null)
 								node = new Node(id, co);
-							node.addTag(key, val.intern());
+							node.addTagFromRawOSM(key, val);
 							ntags++;
 						}
 					}
@@ -132,10 +132,10 @@
 				for (int j = 0; j < binWay.getKeysCount(); j++) {
 
 					String key = getStringById(binWay.getKeys(j));
-					String val = getStringById(binWay.getVals(j)).trim();
+					String val = getStringById(binWay.getVals(j));
 					key = keepTag(key, val);
 					if (key != null)
-						way.addTag(key, val.intern());
+						way.addTagFromRawOSM(key, val);
 				}
 
 				long nid = 0;
@@ -157,7 +157,7 @@
 				boolean tagsIncomplete = false;
 				for (int j = 0; j < binRel.getKeysCount(); j++) {
 					String key = getStringById(binRel.getKeys(j));
-					String val = getStringById(binRel.getVals(j)).trim();
+					String val = getStringById(binRel.getVals(j));
 					// type is required for relations - all other tags are filtered
 					if ("type".equals(key))
 						// intern the string
@@ -167,7 +167,7 @@
 					if (key == null)
 						tagsIncomplete = true;
 					else
-						rel.addTag(key, val.intern());
+						rel.addTagFromRawOSM(key, val);
 				}
 
 				if (tagsIncomplete) {
Index: src/uk/me/parabola/mkgmap/reader/osm/o5m/O5mBinHandler.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/o5m/O5mBinHandler.java	(revision 3643)
+++ src/uk/me/parabola/mkgmap/reader/osm/o5m/O5mBinHandler.java	(working copy)
@@ -314,7 +314,7 @@
 		while (bytesToRead > 0){
 			readStringPair();
 			String key = stringPair[0];
-			String val = stringPair[1].trim();
+			String val = stringPair[1];
 			// the type tag is required for relations - all other tags are filtered
 			if (elem instanceof Relation && "type".equals(key))
 				// intern the string
@@ -322,7 +322,7 @@
 			else
 				key = keepTag(key, val);
 			if (key != null)
-				elem.addTag(key, val.intern());
+				elem.addTagFromRawOSM(key, val);
 			else 
 				tagsIncomplete = true;
 		}
Index: src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java	(revision 3643)
+++ src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java	(working copy)
@@ -207,7 +207,7 @@
 	private void startInNode(String qName, Attributes attributes) {
 		if (qName.equals("tag")) {
 			String key = attributes.getValue("k");
-			String val = attributes.getValue("v").trim();
+			String val = attributes.getValue("v");
 
 			// We only want to create a full node for nodes that are POI's
 			// and not just one point of a way.  Only create if it has tags that
@@ -219,7 +219,7 @@
 					currentNode = new Node(currentElementId, co);
 				}
 
-				currentNode.addTag(key, val.intern());
+				currentNode.addTagFromRawOSM(key, val);
 			}
 		}
 	}
@@ -235,10 +235,10 @@
 			addCoordToWay(currentWay, id);
 		} else if (qName.equals("tag")) {
 			String key = attributes.getValue("k");
-			String val = attributes.getValue("v").trim();
+			String val = attributes.getValue("v");
 			key = keepTag(key, val);
 			if (key != null)
-				currentWay.addTag(key, val.intern());
+				currentWay.addTagFromRawOSM(key, val);
 		}
 	}
 
@@ -276,7 +276,7 @@
 				currentRelation.addElement(attributes.getValue("role"), el);
 		} else if (qName.equals("tag")) {
 			String key = attributes.getValue("k");
-			String val = attributes.getValue("v").trim();
+			String val = attributes.getValue("v");
 			// the type tag is required for relations - all other tags are filtered
 			if ("type".equals(key))
 				// intern the key
@@ -286,7 +286,7 @@
 			if (key == null) {
 				currentRelation.addTag(TAGS_INCOMPLETE_TAG, "true");
 			} else {
-				currentRelation.addTag(key, val.intern());
+				currentRelation.addTagFromRawOSM(key, val);
 			}
 		}
 	}
Index: test/uk/me/parabola/mkgmap/reader/osm/ElementTest.java
===================================================================
--- test/uk/me/parabola/mkgmap/reader/osm/ElementTest.java	(revision 3643)
+++ test/uk/me/parabola/mkgmap/reader/osm/ElementTest.java	(working copy)
@@ -54,4 +54,27 @@
 				new String[] {"1", "2", "3"},
 				values.toArray());
 	}
+
+	@Test
+	public void testaddTagFromRawOSM() {
+		Element el = new Way(1);
+
+		el.addTagFromRawOSM("a", "1");
+		el.addTagFromRawOSM("b", "1 ");
+		el.addTagFromRawOSM("c", " 1");
+		el.addTagFromRawOSM("d", "1  2");
+		el.addTagFromRawOSM("e", "1  2  3");
+		el.addTagFromRawOSM("f", "   1  2  3 4  ");
+		el.addTagFromRawOSM("g", " ");
+		el.addTagFromRawOSM("h", "   ");
+
+		assertEquals("1", el.getTag("a"));
+		assertEquals("1", el.getTag("b"));
+		assertEquals("1", el.getTag("c"));
+		assertEquals("1 2", el.getTag("d"));
+		assertEquals("1 2 3", el.getTag("e"));
+		assertEquals("1 2 3 4", el.getTag("f"));
+		assertEquals("", el.getTag("g"));
+		assertEquals("", el.getTag("h"));
+	}
 }
