codebude / QRCoder

A pure C# Open Source QR Code implementation
MIT License
4.46k stars 1.09k forks source link

Allowed characters in name for swiss qr code #217

Closed lobfeh closed 4 years ago

lobfeh commented 4 years ago

From issue #97 there is a validation of the allowed characters in the swiss qr Code for the name field. From my research i think that the + sign should be allowed. For example in https://www.six-group.com/interbank-clearing/dam/downloads/en/standardization/iso/swiss-recommendations/archives/implementation-guidelines-ct/implementation-guidelines-ct_v1_6.pdf on Page 44 (Point 2.4.1 Character set). Currently the - sign is allowed, but not the + I have not tested it on the qr validation Portal since I don't have an account. Could you do a change to allow the + sign in the regex Expression in PayloadGenerator.cs Line 924 charsetPattern = ...

RetoStaehelin commented 4 years ago

We have the same problem, we have Company names with a "+"

var charsetPattern = @"^([a-zA-Z0-9.,;:'\ -/()?*[]{}\`´~ ]|[!""#%&<>÷=@_$£]|[àáâäçèéêëìíîïñòóôöùúûüýßÀÁÂÄÇÈÉÊËÌÍÎÏÒÓÔÖÙÚÛÜÑ])*$"; if (!Regex.IsMatch(name, charsetPattern)) throw new SwissQrCode.Contact.SwissQrCodeContactException($"Name must match the following pattern as defined in pain.001: {charsetPattern}");

Will there be a Change in the Code?

lobfeh commented 4 years ago

Hello, Could you check this issue? I have created a pull request #225 for it, which can be accepted.

codebude commented 4 years ago

Checked and understood the request. Code changes looked fine, so I merched them. Since I didn't work for a while on this project, let me check the other issues first, before I publish a new Nuget package. If you need early access on these changes, you could use the MyGet-package feed as explained in the readme --> https://github.com/codebude/QRCoder

So far, thanks for your input! 👍