Closed 0xced closed 2 years ago
Thanks for the PR. I will look into it.
Do you have more information about the QR bills with CR only? Where did come from? Did they contain other errors?
I can't share specific details about this problematic QR-bill but I can say that apart from this CR line ending issue, the QR-bill is valid. With this pull request applied, the following code runs fine and returns a valid Bill
object passing all validations:
var bill = QRBill.DecodeQrCodeText(qrCode);
var validationResult = QRBill.Validate(bill);
if (validationResult.HasErrors)
throw new QRBillValidationException(validationResult);
return validationResult.CleanedBill;
Before this pull request DecodeQrCodeText()
fails with Unknown error (data_structure_invalid) because the SplitLines
method returns a single line.
Also, I learnt that a string containing CR line endings, when displayed in a task dialog, is rendered as multi-line, just like if the line endings were CRLF!
The Swiss Implementation Guidelines for the QR-bill explicitly forbids CR as line ending:
But some QR-bills were found in practice using CR as line ending. ¯_(ツ)_/¯