QRCoder icon indicating copy to clipboard operation
QRCoder copied to clipboard

ContactData QR Code generation is wrong

Open EscolarProgramming opened this issue 1 year ago • 6 comments

Type of issue

[x] Bug
[ ] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement

Expected Behavior

Locality, Postal Code and Region should be in the correct fields

Current Behavior

The fields mentioned are in the wrong order. On Android, they are usually read anyway and the values are then entered in the wrong fields. On iOS, fields with incorrect values are simply omitted. As a result, the city name, for example, is never transferred.

Possible Solution (optional)

https://github.com/codebude/QRCoder/blob/master/QRCoder/PayloadGenerator/ContactData.cs#L114 The creation of the string is wrong. Currently: {street} {houseNumber}, {zipCode}, {city}, {stateRegion}, {country} Correct: {street} {houseNumber}, {city}, {stateRegion}, {zipCode}, {country}

Edit: Here's the corresponding RFC: https://www.rfc-editor.org/rfc/rfc6350.html#section-6.3.1 Section 6.3.1.: ADR-value = ADR-component-pobox ";" ADR-component-ext ";" ADR-component-street ";" ADR-component-locality ";" ADR-component-region ";" ADR-component-code ";" ADR-component-country

EscolarProgramming avatar Oct 08 '24 12:10 EscolarProgramming

Would you like to do a PR? If not I could do one. @EscolarProgramming

digitaldirk avatar Oct 09 '24 15:10 digitaldirk

@digitaldirk I can only create a PR at the beginning of next week, if you can do it earlier, feel free to do it yourself

EscolarProgramming avatar Oct 09 '24 15:10 EscolarProgramming

Hi @EscolarProgramming ,

thanks for your feedback. Two notes:

https://github.com/codebude/QRCoder/blob/master/QRCoder/PayloadGenerator/ContactData.cs#L114 The creation of the string is wrong.

You're pointing to line 114 which is part of the MeCard address handling. Do you really mean the MeCard behaviour or did you mean vCard (lines 193ff -> https://github.com/codebude/QRCoder/blob/master/QRCoder/PayloadGenerator/ContactData.cs#L193 )

To get it right. You expect the behaviour of AddressOrder.Reversed mode, but with street + housenumber in European format (as in AddressOrder.Default) correct?

codebude avatar Oct 09 '24 18:10 codebude

@codebude I'll leave this one to you (after looking into I got a little confused and feel like you're more qualified with the US vs Europe formatting 😃)

I did however convert that file to use stringbuilder instead of string concatenation if you want a seperate PR (and maybe I could go through and find more places to do this as well?)

Thanks

digitaldirk avatar Oct 09 '24 21:10 digitaldirk

@codebude You are right, I meant vCard. Bug reporting on my mobile phone ist hard :D I don‘t know if the MeCard one is wrong too.

And yes, your second paragraph is my expected behaviour (and in my opinion the right one in regards of the RFC).

EscolarProgramming avatar Oct 10 '24 16:10 EscolarProgramming

Hi @codebude ! Just wanted to ask if you'll fix it or if I should fix it or if I should use the Reversed address order and swap street and house number in my code

EscolarProgramming avatar Oct 17 '24 11:10 EscolarProgramming