OneIdentity / safeguard-ps

One Identity Safeguard PowerShell scripting resources
Apache License 2.0
22 stars 27 forks source link

Add a parameter to modify the delimiter when importing csv #494

Closed f3yn-m4n closed 9 months ago

f3yn-m4n commented 1 year ago

We encountered issues when importing accounts/assets/passwords containing a comma, so I added a parameter to specify the parsing character to be used when importing the CSV

JeffHarkavy commented 1 year ago

@paulhueso A properly quoted CSV file already allows values containing a comma (see RFC 4180) e.g.,

"Provider","NewUserName","FirstName","LastName","Description","DomainName","EmailAddress","WorkPhone","MobilePhone","AdminRoles","Password","Thumbprint"
"Local","fred","Fred","Anon","description, containing, commas","","","123456789","987654321","","Test,With,Commas",""

Is there a reason values can't be quoted?

f3yn-m4n commented 1 year ago

Some values already contained double quotes which broke everything even when escaped:

"Description","Name"
"test`",`"",SomeName"
"test\",\"",SomeOtherName"

The comma is still parsed as a delimiter.

JeffHarkavy commented 1 year ago

The CSV file standard is that a double quote is escaped by preceding it with another double quote, aka, double-double quote

"Description","Name"
"description, containing"","" commas and double quotes","SomeName"