Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect character rendering when scanning vCard QR code on iPhone #130

Open
diegonicolas250 opened this issue Jun 29, 2023 · 1 comment

Comments

@diegonicolas250
Copy link

Hello, when scanning a QR code generated with vCard data on an iPhone device, the characters are not displayed correctly. This issue is specific to iPhone devices, as the QR code scans correctly on Android devices. The problem seems to be related to character encoding or rendering on iOS.

Code Snippet:

function vCard(User $user): string
{
   return "BEGIN:VCARD\r\n" .
       "VERSION:4.0\r\n" .
       "N:José María example;;\r\n" .
       "FN:{$user->fullName()}\r\n" .
       "TITLE:{$user->workPosition}\r\n" .
       "EMAIL;TYPE=work:{$user->email}\r\n" .
       "TEL;TYPE=\"voice,work\":{$user->phone}\r\n" .
       "ORG:TEST\r\n" .
       "END:VCARD\r\n";
}


$data = [
....
'barcode' => [
       'format' => 'PKBarcodeFormatQR',
       'message' => vCard($user),
       'messageEncoding' => 'iso-8859-1',
   ],
   'barcodes' => [
       [
           'format' => 'PKBarcodeFormatQR',
           'message' => vCard($user),
           'messageEncoding' => 'iso-8859-1',
       ],
   ],
...]

Actual Behavior

When I scan the QR with iPhone, the name displayed on the contact is Jos√© Mar√≠a instead of José María.
I have tried changing the messageEncoding to UFT-8 but the result is the same.

Steps to reproduce

Steps to Reproduce:

  1. Generate a vCard QR code using the provided code snippet.
  2. Scan the generated QR code using the default iPhone camera app or a QR code scanning app.
  3. Observe that the characters in the scanned data are displayed incorrectly, with accent marks and special characters not rendered correctly.
@tschoffelen
Copy link
Owner

This is definitely a super interesting one! I don't think we do anything special when it comes to saving the JSON payload, we just json_encode it and save the file.

Could this be related to the vcard format itself?

https://stackoverflow.com/a/9222600/1129689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants