- Timestamp:
- 2020-08-28T22:38:26+02:00 (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java
r16951 r16952 672 672 return formatAsHtmlUnorderedList(Collections.singletonList(primitive), 1); 673 673 } 674 675 /** 676 * Removes the bidirectional text characters U+200C, U+200E, U+200F from the string 677 * @param string the string 678 * @return the string with the bidirectional text characters removed 679 */ 680 public static String removeBiDiCharacters(String string) { 681 return string.replaceAll("[\\u200C\\u200E\\u200F]", ""); 682 } 674 683 } -
trunk/src/org/openstreetmap/josm/gui/datatransfer/PrimitiveTransferable.java
r16951 r16952 9 9 import java.util.List; 10 10 11 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 11 12 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 12 13 import org.openstreetmap.josm.data.osm.PrimitiveData; … … 91 92 sb.append(OsmPrimitiveType.from(primitive).getAPIName()).append(' ').append(primitive.getId()); 92 93 } 93 return sb.toString() .replace("\u200C", "").replace("\u200E", "").replace("\u200F", "");94 return DefaultNameFormatter.removeBiDiCharacters(sb.toString()); 94 95 } 95 96 } -
trunk/src/org/openstreetmap/josm/gui/datatransfer/RelationMemberTransferable.java
r16951 r16952 107 107 .append('\n'); 108 108 } 109 return sb.toString() .replace("\u200C", "").replace("\u200E", "").replace("\u200F", "");109 return DefaultNameFormatter.removeBiDiCharacters(sb.toString()); 110 110 } 111 111 -
trunk/test/unit/org/openstreetmap/josm/data/osm/DefaultNameFormatterTest.java
r16951 r16952 168 168 TestUtils.newNode("tourism=hotel name:en=foo url=http://foo.bar xml=<tag/>"))); 169 169 } 170 171 /** 172 * Test of {@link DefaultNameFormatter#removeBiDiCharacters(String)}. 173 */ 174 @Test 175 public void testRemoveBiDiCharacters() { 176 assertEquals("building (0 nodes)", DefaultNameFormatter.removeBiDiCharacters("\u200Ebuilding\u200E (0 nodes)\u200C")); 177 } 170 178 }
Note:
See TracChangeset
for help on using the changeset viewer.