Ticket #24553: 24553.patch

File 24553.patch, 1.3 KB (added by GerdP, 3 days ago)

Quick Patch to remove unwanted characters. Constant taken from TagChecker

  • src/org/openstreetmap/josm/gui/widgets/OsmIdTextField.java

     
    66import java.util.ArrayList;
    77import java.util.List;
    88import java.util.StringTokenizer;
     9import java.util.regex.Pattern;
    910
    1011import javax.swing.text.JTextComponent;
    1112
     
    2021 * @author Matthias Julius
    2122 */
    2223public class OsmIdTextField extends AbstractIdTextField<OsmIdTextField.OsmIdValidator> {
     24    private static final Pattern UNWANTED_NON_PRINTING_CONTROL_CHARACTERS = Pattern.compile(
     25            "[\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F\\u200e-\\u200f\\u202a-\\u202e]");
    2326
    2427    /**
    2528     * Constructs a new {@link OsmIdTextField}
     
    98101                return false;
    99102            }
    100103            ids.clear();
    101             StringTokenizer st = new StringTokenizer(value, ",.+/ \t\n");
     104            String stripped = UNWANTED_NON_PRINTING_CONTROL_CHARACTERS.matcher(value).replaceAll("");
     105            StringTokenizer st = new StringTokenizer(stripped, ",.+/ \t\n");
    102106            String s;
    103107            while (st.hasMoreTokens()) {
    104108                s = st.nextToken();