Fix: default FN should be trimmed
authorNiki Roo <niki@nikiroo.be>
Sat, 2 Apr 2016 12:57:38 +0000 (14:57 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 2 Apr 2016 12:57:38 +0000 (14:57 +0200)
src/be/nikiroo/jvcard/BaseClass.java
src/be/nikiroo/jvcard/launcher/Main.java

index 026c5b43c0951a02ceb69e3bbda049be4303945c..932337671d939885f10157769f258ba4ed73c563 100644 (file)
@@ -450,20 +450,19 @@ public abstract class BaseClass<E extends BaseClass<?>> implements List<E> {
        }
 
        /**
-        * Escape the given value to VCF standard.
+        * Unescape the given value from the VCF standard.
         * 
         * @param value
-        *            the value to escape
+        *            the value to unescape
         * 
-        * @return the escaped value
+        * @return the unescaped value
         */
        protected String unescape(String value) {
                if (value == null)
                        return null;
 
                return value.replaceAll("\\\\,", ",").replaceAll("\\\\;", ";")
-
-               .replaceAll("\\\\n", "\n");
+                               .replaceAll("\\\\n", "\n");
        }
 
        /**
index f193be1b493ae81c09178c1f446ca5563f4ce917..f96e5581b05f99c12f69c3af4603284f4065815f 100644 (file)
@@ -429,7 +429,8 @@ public class Main {
                                        + trans(StringId.CLI_HELP_LANG));
                        System.out.println("\t--tui : " + trans(StringId.CLI_HELP_TUI));
                        System.out.println("\t--gui : " + trans(StringId.CLI_HELP_GUI));
-                       System.out.println("\t--noutf : " + trans(StringId.CLI_HELP_NOUTF_OPTION));
+                       System.out.println("\t--noutf : "
+                                       + trans(StringId.CLI_HELP_NOUTF_OPTION));
                        System.out.println("\t--config : "
                                        + trans(StringId.CLI_HELP_CONFIG));
                        System.out.println();
@@ -500,7 +501,7 @@ public class Main {
                                        Data name = contact.getPreferredData("FN");
                                        if (name == null || name.getValue().length() == 0
                                                        || forceComputedFn) {
-                                               name.setValue(contact.toString(defaultFn, ""));
+                                               name.setValue(contact.toString(defaultFn, "").trim());
                                        }
                                }
                        } catch (Exception e) {