aspettl / delphi-sepa-xml

Delphi-Unit zur Erstellung von SEPA-XML-Dateien
Other
6 stars 6 forks source link

Allow escaped characters like & > & #1

Closed MicrotronX closed 6 years ago

MicrotronX commented 6 years ago

in Current version your CharIsSEPAWhitelisted() function is removing the ; character, if we escape the strings like:

"CustomerCompany GmbH & Co. KG" to "CustomerCompany GmbH & amp; Co. KG" after output it is written as "CustomerCompany GmbH &amp Co. KG" and the ; is missing.

Without escaping the & char the xml-file cannot be validated. Add ; to your CharisSEPAWhitelisted() and everything works.

ps: Note that we had to insert a space between & and amp in above example to show it here ...

aspettl commented 6 years ago

Hello,

invalid characters are replaced by e.g. a space (and "&" should actually be replaced by "+" at the moment), a semicolon is not in the whitelist.

This means: using & is not supported - and I'm not sure what the best way to do that would be. It seems some banks support this (see e.g. [1]), but is there some common ground? Then such escaping of e.g. "&" could be done directly (passing in already escaped content from the outside doesn't sound like a good design to me).

In principle, I prefer avoiding invalid files to supporting every character possible. Are you in Germany and do you use the "SEPASupportSpecialChars" option? Can you try an unescaped "&", does this work for you? Reading the documentation from [2], Anlage_3_Datenformate_V3.2.pdf, page 5, it looks like an unescaped "&" should be fine (!) - this should be supported at the moment, but it may be replaced by "+" by the bank.)

[1] http://www.sepaforcorporates.com/sepa-implementation/valid-xml-characters-sepa-payments/ [2] http://www.ebics.de/index.php?id=77

MicrotronX commented 6 years ago

Since were escaping all in standard XML and allowed ; char in XML output with your component everything works perfect. The SEPASupportSpecialChars Option is enabled but if you remove the semicolon char in XML output, default escaping is not working anymore because & is changed to &amp without semicolon. We have changed this in your source and added the semicolon in whitelist.

aspettl commented 6 years ago

Fixed by https://github.com/aspettl/delphi-sepa-xml/pull/4