TheGeneGenieProject / GeneGenie.Gedcom

A .Net library for loading, saving, working with and analysing family trees stored in the GEDCOM format.
GNU Affero General Public License v3.0
52 stars 22 forks source link

GedComName, Property Name, Set: Problems with additional spaces #86

Closed OkapiD closed 4 years ago

OkapiD commented 4 years ago

If you have a NAME tag, formatted with slashes at surname and additional leading spaces like

givenname / surname/

parsing is incorrect. you get some additional repeated characters at the end of NAME line.

My quick and dirty solution (working for me) is to remove spaces near slashes and double spaces in property Name, set:

while (name.Contains(" ")) name = name.Replace(" ", " "); while (name.Contains("/ ")) name = name.Replace("/ ", "/"); while (name.Contains(" /")) name = name.Replace(" /", "/");

RyanONeill1970 commented 4 years ago

I'll have a look. Sorry the slow reply, I've been looking at building a GEDCOM parser in F# instead (for code quality reason mostly).

If you have unit tests for any of these then that would be helpful too.

OkapiD commented 4 years ago

Thank you for reply. No further problems after my workarounds. The api is working great for my purpose. But maybe my experiences can help to improve it a little bit. I apologize for only sending the bug reports resp. the feature idea. I am not familiar with tests and the api internals.

RyanONeill1970 commented 4 years ago

Are you able to share a GEDCOM file which demonstrates this? I've been importing ones with leading and trailing spaces and it seems OK. So I'm probably not testing for the exact same conditions as you are finding. It does trim the spaces, which I think is incorrect if they are quoted with slashes.

OkapiD commented 4 years ago

If you have in Gedcom input

1 NAME Peter / Olsen/

than you have in Gedcom output:

1 NAME Peter /Olsen/ sen/

Am Mo., 13. Juli 2020 um 12:22 Uhr schrieb RyanONeill1970 < notifications@github.com>:

Are you able to share a GEDCOM file which demonstrates this? I've been importing ones with leading and trailing spaces and it seems OK. So I'm probably not testing for the exact same conditions as you are finding. It does trim the spaces, which I think is incorrect if they are quoted with slashes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TheGeneGenieProject/GeneGenie.Gedcom/issues/86#issuecomment-657472918, or unsubscribe https://github.com/notifications/unsubscribe-auth/APNI2BKCZZHQH23Y4JFEXKDR3LN6BANCNFSM4OQ2GFNQ .

RyanONeill1970 commented 4 years ago

Thanks, it is resolved now. New build going through and nuget should come out the other end in 30 minutes.