parse quoted printable properly at importing contacts

This commit is contained in:
tibbi 2018-08-11 18:42:16 +02:00
parent 991e4d1e75
commit 7acfde6bb0
1 changed files with 9 additions and 4 deletions

View File

@ -196,12 +196,17 @@ class VcfImporter(val activity: SimpleActivity) {
val type = getAddressTypeId(rawType.toUpperCase()) val type = getAddressTypeId(rawType.toUpperCase())
val addresses = addressParts[1].split(";") val addresses = addressParts[1].split(";")
if (addresses.size == 7) { if (addresses.size == 7) {
if (address.contains(";CHARSET=UTF-8:")) { var parsedAddress = if (address.contains(";CHARSET=UTF-8:")) {
val fullAddress = TextUtils.join(", ", addresses.filter { it.trim().isNotEmpty() }) TextUtils.join(", ", addresses.filter { it.trim().isNotEmpty() })
curAddresses.add(Address(fullAddress, type))
} else { } 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))
} }
} }