Skip to content

Commit e66ec05

Browse files
committed
add the info declaring quoted-printable at exported vcf when necessary
1 parent 6fd7714 commit e66ec05

File tree

1 file changed

+4
-2
lines changed
  • app/src/main/kotlin/com/simplemobiletools/contacts/helpers

1 file changed

+4
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfExporter.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class VcfExporter {
3636
for (contact in contacts) {
3737
out.writeLn(BEGIN_VCARD)
3838
out.writeLn(VERSION_2_1)
39-
out.writeLn("$N:${getNames(contact)}")
39+
out.writeLn("$N${getNames(contact)}")
4040

4141
contact.phoneNumbers.forEach {
4242
out.writeLn("$TEL;${getPhoneNumberLabel(it.type)}:${it.value}")
@@ -92,6 +92,7 @@ class VcfExporter {
9292
}
9393

9494
private fun getNames(contact: Contact): String {
95+
var result = ""
9596
var firstName = contact.firstName
9697
var surName = contact.surname
9798
var middleName = contact.middleName
@@ -102,9 +103,10 @@ class VcfExporter {
102103
firstName = QuotedPrintable.encode(firstName)
103104
surName = QuotedPrintable.encode(surName)
104105
middleName = QuotedPrintable.encode(middleName)
106+
result += ";CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE"
105107
}
106108

107-
return "$surName;$firstName;$middleName;;"
109+
return "$result:$surName;$firstName;$middleName;;"
108110
}
109111

110112
private fun getPhoneNumberLabel(type: Int) = when (type) {

0 commit comments

Comments
 (0)