Code Monkey home page Code Monkey logo

vcards's People

Contributors

folkerkinzel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vcards's Issues

[Not a Bug] VCF Nextcloud, library not parsing photo actual content properly

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):

  • OS: Windows 11
  • .NET Version: 6.0
  • Library version: 4.0

Additional context
See attachment for example file:
3eddee69-e082-42b6-b740-beebf2457f11.txt

[Feature Request] UID parsing fails for values others than UUIDs

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

[Not a Bug] URLs serialization in vcard 3.0 only serialize the first URL

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):

  • OS: Windows 10
  • .NET Version: NET 6.0

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 ?

[Bug] NonStandardProperty not working

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):

  • Windows
  • .NET 6.0
  • Library version: 4.0.0

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.

CHARSETS not handled correctly

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.

Not support for TEL;TYPE=WhatsApp:

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:

Wrong Label Parameter for Address

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):

  • OS: Windows 10 eng
  • .NET Version: .Net 4.8.1

Additional context
Rudi Wimmel2 von Outlook.zip

P.S.: Sorry to bother you again! Heinz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.