mixerp / MixERP.Net.VCards

vCard Serializer and Parser for C#
Apache License 2.0
71 stars 42 forks source link

Logic of parsing values with commas is flawed #8

Open afterlogic-support opened 6 years ago

afterlogic-support commented 6 years ago

The way the code is written makes it impossible to preserve commas in comma-separated lists.

For instance, if we have this:

 CATEGORIES:Home\,Sport,Group

After parsing we should have two categories: "Home,Sport" and "Group". But we end up with three: "Home", "Sport", "Group". And the code is written the way which makes it hardly possible to quick-fix this. The code first eliminates escaping in tokenizer (so that you'll have "Home,Sport,Group" down the code) and then splits it by individual tokens and so on.

It does not make any difference between tokens which are just text and which are comma-separated lists (like CATEGORIES). So, "\," and "," become equivalent after Sanitizer.UnEscape processing.