diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-11-09 12:22:11 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-11-09 12:22:11 +0100 |
| commit | e71fd4b03be53058637481a24c7d7333c0e6d263 (patch) | |
| tree | 3850be925425a51a6bb1e9da9936fb5195c104c7 /main/src/cgeo/geocaching/utils/TextUtils.java | |
| parent | 9c9650f91a30bd9a481fe84ac249349aeb43c27a (diff) | |
| download | cgeo-e71fd4b03be53058637481a24c7d7333c0e6d263.zip cgeo-e71fd4b03be53058637481a24c7d7333c0e6d263.tar.gz cgeo-e71fd4b03be53058637481a24c7d7333c0e6d263.tar.bz2 | |
fix #3402: crash on GPX export
Diffstat (limited to 'main/src/cgeo/geocaching/utils/TextUtils.java')
| -rw-r--r-- | main/src/cgeo/geocaching/utils/TextUtils.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/utils/TextUtils.java b/main/src/cgeo/geocaching/utils/TextUtils.java index 302a65d..14caf1d 100644 --- a/main/src/cgeo/geocaching/utils/TextUtils.java +++ b/main/src/cgeo/geocaching/utils/TextUtils.java @@ -153,4 +153,16 @@ public final class TextUtils { return str.indexOf('<') != -1 || str.indexOf('&') != -1; } + /** + * Remove all control characters (which are not valid in XML or HTML), as those should not appear in cache texts + * anyway + * + * @param input + * @return + */ + public static String removeControlCharacters(final String input) { + Matcher remover = PATTERN_REMOVE_NONPRINTABLE.matcher(input); + return remover.replaceAll(" ").trim(); + } + } |
