From 7acfde6bb023aafe16381d4c068085fb6e7377cb Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 11 Aug 2018 18:42:16 +0200 Subject: [PATCH] parse quoted printable properly at importing contacts --- .../contacts/helpers/VcfImporter.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt index 33c459f3..dc94f12d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfImporter.kt @@ -196,12 +196,17 @@ class VcfImporter(val activity: SimpleActivity) { val type = getAddressTypeId(rawType.toUpperCase()) val addresses = addressParts[1].split(";") if (addresses.size == 7) { - if (address.contains(";CHARSET=UTF-8:")) { - val fullAddress = TextUtils.join(", ", addresses.filter { it.trim().isNotEmpty() }) - curAddresses.add(Address(fullAddress, type)) + var parsedAddress = if (address.contains(";CHARSET=UTF-8:")) { + TextUtils.join(", ", addresses.filter { it.trim().isNotEmpty() }) } else { - curAddresses.add(Address(addresses[2].replace("\\n", "\n"), type)) + addresses[2].replace("\\n", "\n") } + + if (address.contains("QUOTED-PRINTABLE")) { + parsedAddress = QuotedPrintable.decode(parsedAddress) + } + + curAddresses.add(Address(parsedAddress, type)) } }