Merge pull request #7332 from markmckinnon/8033-Non-ASCII-VCARD-not-parsed-correctly

8033-Non-ASCII-VCARD-not-parsed-correctly
This commit is contained in:
Ann Priestman 2021-10-06 11:51:42 -04:00 committed by GitHub
commit e23c2ce05d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
} }
} }