diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index 228f7150..285eed93 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -2788,7 +2788,7 @@ public abstract class ExchangeSession { properties.put("im", property.getValue()); } else if ("BDAY".equals(property.getKey())) { properties.put("bday", convertBDayToZulu(property.getValue())); - } else if ("ANNIVERSARY".equals(property.getKey())) { + } else if ("ANNIVERSARY".equals(property.getKey()) || "X-ANNIVERSARY".equals(property.getKey())) { properties.put("anniversary", convertBDayToZulu(property.getValue())); } else if ("CATEGORIES".equals(property.getKey())) { properties.put("keywords", property.getValue()); diff --git a/src/java/davmail/exchange/VCardWriter.java b/src/java/davmail/exchange/VCardWriter.java index 07e7cce6..66221dcb 100644 --- a/src/java/davmail/exchange/VCardWriter.java +++ b/src/java/davmail/exchange/VCardWriter.java @@ -31,11 +31,24 @@ public class VCardWriter extends ICSBufferedWriter { if ((propertyValue != null) && (propertyValue.length() > 0)) { write(propertyName); write(":"); - writeLine(propertyValue); + writeLine(encodeMultiline(propertyValue)); } } + protected String encodeMultiline(String value) { + StringBuilder buffer = new StringBuilder(); + for (int i = 0; i < value.length(); i++) { + char c = value.charAt(i); + if (c == '\n') { + buffer.append("\\n"); + } else { + buffer.append(value.charAt(i)); + } + } + return buffer.toString(); + } + public void appendProperty(String propertyName, String... propertyValue) { boolean hasValue = false; for (String value : propertyValue) {