folkerkinzel / vcards Goto Github PK
View Code? Open in Web Editor NEW.NET library for reading, writing, and converting VCF files that comply with vCard standards 2.1, 3.0 and 4.0
License: MIT License
.NET library for reading, writing, and converting VCF files that comply with vCard standards 2.1, 3.0 and 4.0
License: MIT License
Describe the bug
In Nextcloud 25 - create a new contact, add a photo to the contact. Generates attached VCF. When library parses the VCF file it is missing out on the actual photo it's base64 content. It does seem to recognize the Encoding and MediaType.
To Reproduce
Code to reproduce the behavior:
string contentsVCFFile = ...
var convertedItem = VCard.ParseVcf(contentsVCFFile );
Expected behavior
I'd expect the base64 value to be available.
Desktop (please complete the following information):
Additional context
See attachment for example file:
3eddee69-e082-42b6-b740-beebf2457f11.txt
Hi Folker,
your libary looks great but I have a problem with the photo. The attached file is a standard outlook contact file saved as *.vcf. Any idea how to solve this problem?
Describe the bug
UID of some VCARD 3.0 items are not properly recognized.
To Reproduce
using FolkerKinzel.VCards;
string vcard3 = @"
BEGIN:VCARD
VERSION:3.0
REV:2010-03-29T09:23:34Z
UID:[email protected]
N:Dude;Some;Fred;;
FN:Some dude
NOTE:Simplified card for testing (Sogo Connector)
NICKNAME:fred
ROLE:Geek
END:VCARD
";
var vcard = Vcf.Parse(vcard3).FirstOrDefault();
if (vcard is not null)
{
Console.WriteLine($"Version: {vcard.Version}");
Console.WriteLine($"UID: {vcard.ID?.Value} (Should be '[email protected]')");
Console.WriteLine($"Note: {vcard.Notes}");
}
Expected behavior
see https://datatracker.ietf.org/doc/html/rfc6350#section-6.7.6, UID --> "Free-form text MAY also be used."
To avoid breaking the current UID UUID typing, maybe offer the original unmodified UID in a separate property
Describe the bug
URLs serialization only serialize the first URL, other URLs are ignored
To Reproduce
Please check this fiddle:
https://dotnetfiddle.net/56fnoa
Expected behavior
All URLs should be serialized. As in the example, a line group1.URL:http://facebook.com
should be in the result
Desktop (please complete the following information):
Additional context
Any reasons why in vcard 4.0 serialization code, you are using BuildPropertyCollection
for the URLs (that serialize to the correct result), but in 3.0 and 2.1 you are using BuildPrefProperty
that only serialize the first URL it found ?
Describe the bug
NonStandardProperties do not seem to work unless you assign them to example another property like phone. I'd expect if you would assign anything to NonStandardProperties, it would be written to the serialized body. This is unfortunately not the case.
With VcfOptions.All set, instead of VcfOptions.WriteNonStandardParameters it works.
To Reproduce
var vcard = new VCard()
{
DisplayNames = new List<TextProperty>() { new TextProperty("Test1") },
Titles = new List<TextProperty>() { new TextProperty("Test2") },
Organizations = new List<OrganizationProperty>() { new OrganizationProperty("Test3") },
NameViews = new NameProperty
(
lastName: new string[] { "Test4" },
firstName: new string[] { "Test5" },
middleName: new string[] { "Test6" },
prefix: new string[] { "Test7" }
),
PhoneNumbers = new TextProperty("Test8"),
EmailAddresses = new TextProperty("Test9")
};
var nonStandard1 = new NonStandardProperty("X-NON-STANDARD", "The value");
nonStandard1.Parameters.NonStandardParameters
= new KeyValuePair<string, string>[] { new KeyValuePair<string, string>("X-NONSTD", "para-value") };
var nonStandard = new NonStandardProperty[] { nonStandard1 };
vcard.NonStandardProperties = nonStandard;
string serializedBody = VCard.ToVcfString(vcard, options: VcfOptions.Default | VcfOptions.WriteNonStandardParameters);
Expected behavior
Currently with above code the VCF body is:
BEGIN:VCARD
VERSION:3.0
FN:Test1
N:Test4;Test5;Test6;Test7;
TITLE:Test2
ORG:Test3
TEL:Test8
EMAIL;TYPE=INTERNET:Test9
END:VCARD
What I would expect (note X-NON-STANDARD):
BEGIN:VCARD
VERSION:3.0
FN:Test1
N:Test4;Test5;Test6;Test7;
TITLE:Test2
ORG:Test3
TEL:Test8
EMAIL;TYPE=INTERNET:Test9
X-NON-STANDARD:The Value
END:VCARD
Desktop (please complete the following information):
Additional context
I'd just like to give some hidden properties within the contact, not to be displayed to the user, unlike the whatsapp example.
First of all: Thank you for your effort!
VCFs that contain fields that are encoded with a certain CHARSET cannot be read correctly, because the extended characters got lost already when the vcf file was loaded by your code. Although the LoadVcf and ParseVcf methods have an optional encoding parameter, but this would mean that I had to guess the correct CHARSET in advance.
The VCards code should accept and process CHARSET parameters, so that fields with CHARSET are read with the correct encoding
My workaround was to read the Vcf into memory as a string, search for "CHARSET=" anywhere and read teh value afterwards (e.g. "Windows-1252". Then I open the file again using this encoding. This assumes that multiple CHARSET parameters in the same file all use the same encoding.
I use Xiamoi mi 8, Android 10.
Export from my mobile all contacts to vcf file.
Some contacts has TEL;TYPE=WhatsApp:
BEGIN:VCARD
VERSION:3.0
N:;zzMad Perla 45;;;
FN:zzMad Perla 45
TEL;TYPE=HOME:7yy-zzz-xxx
TEL;TYPE=WhatsApp:7yy-zzz-xxx
URL:https://www.xxxxxx
NOTE;CHARSET=UTF-8:PERLA\nmadrid
END:VCARD
More real samples in http://unc.esy.es/jw/00001.vcf
TEL;TYPE=WhatsApp:
Describe the bug
Wrong Label Parameter for address
To Reproduce
Open the attached .vcf with the ParseVcf method using Windows-125 encoding.
The vcf contains 3 addresses and was created using MS Outlook.
Expected behavior
The "Label" property for the first of the three addresses should be "Business-Straße 19\r\n76543 Schaffhausen", matching the first address value
Instead the "Label" property is the same as of the 3rd address: "Sonstgasse 44\r\n37465 Anderstadt"
Desktop (please complete the following information):
Additional context
Rudi Wimmel2 von Outlook.zip
P.S.: Sorry to bother you again! Heinz
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.