Update VcardParser.java

Reading the VCF file needs to be read in using the UTF8 character set.
This commit is contained in:
Mark McKinnon 2021-10-05 21:37:49 -04:00
parent 0e884bb33c
commit f68485e4bd

View File

@ -27,9 +27,12 @@ import ezvcard.property.Organization;
import ezvcard.property.Photo; import ezvcard.property.Photo;
import ezvcard.property.Telephone; import ezvcard.property.Telephone;
import ezvcard.property.Url; import ezvcard.property.Url;
import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -144,7 +147,7 @@ final class VcardParser {
* @throws NoCurrentCaseException If there is no open case. * @throws NoCurrentCaseException If there is no open case.
*/ */
void parse(AbstractFile abstractFile) throws IOException, NoCurrentCaseException { void parse(AbstractFile abstractFile) throws IOException, NoCurrentCaseException {
for (VCard vcard: Ezvcard.parse(new ReadContentInputStream(abstractFile)).all()) { for (VCard vcard: Ezvcard.parse(new InputStreamReader(new BufferedInputStream(new ReadContentInputStream(abstractFile)), StandardCharsets.UTF_8)).all()) {
addContactArtifact(vcard, abstractFile); addContactArtifact(vcard, abstractFile);
} }
} }