Index: test/org/openstreetmap/josm/test/OsmWriterTest.java
===================================================================
--- test/org/openstreetmap/josm/test/OsmWriterTest.java	(revision 58)
+++ test/org/openstreetmap/josm/test/OsmWriterTest.java	(revision 61)
@@ -10,4 +10,5 @@
 import junit.framework.TestCase;
 
+import org.jdom.Attribute;
 import org.jdom.Element;
 import org.jdom.JDOMException;
@@ -57,4 +58,18 @@
 	}
 
+	@Bug(59)
+	public void testSpecialChars() throws Exception {
+		StringBuilder sb = new StringBuilder();
+		for (int i = 32; i < 0xd800; ++i)
+			sb.append((char)i);
+		String s = sb.toString();
+		n1.put(Key.get(s), s);
+		reparse();
+		assertEquals(1, nodes.get(0).getChildren().size());
+		Attribute key = ((Element)nodes.get(0).getChildren().get(0)).getAttribute("k");
+		assertEquals(s, key.getValue());
+		Attribute value = ((Element)nodes.get(0).getChildren().get(0)).getAttribute("v");
+		assertEquals(s, value.getValue());
+	}
 	
 	public void testLineSegment() throws Exception {
@@ -110,5 +125,5 @@
 	 */
 	@Bug(47)
-	public void testDeleteNewDoesReallyRemove() throws IOException, JDOMException {
+	public void testDeleteNewDoesReallyRemove() throws Exception {
 		ds.tracks.iterator().next().setDeleted(true);
 		reparse();
@@ -120,5 +135,5 @@
 	 * Verify that action tag is set correctly.
 	 */
-	public void testActionTag() throws IOException, JDOMException {
+	public void testActionTag() throws Exception {
 		int id = 1;
 		for (OsmPrimitive osm : ds.allPrimitives())
