Skip to content

Fix Chinese/UTF-8 mojibake on QR import + long-press rename - #1588

Open
onewhitethreee wants to merge 2 commits into
Authenticator-Extension:devfrom
onewhitethreee:fix/qr-utf8-mojibake-and-longpress-rename
Open

onewhitethreee wants to merge 2 commits into
Authenticator-Extension:devfrom
onewhitethreee:fix/qr-utf8-mojibake-and-longpress-rename

Conversation

@onewhitethreee

Copy link
Copy Markdown

Summary

  • Fix UTF-8 mojibake when importing OTP entries from QR images with non-ASCII (e.g. Chinese) issuer/account names:
    • migration.ts: decode the Google Authenticator export protobuf's account/issuer bytes with TextDecoder instead of String.fromCharCode (the latter treats each UTF-8 byte as Latin-1, garbling multi-byte characters).
    • QrImport.vue / content.ts: try jsQR (decodes byte-mode QR data as UTF-8) first, only falling back to qrcode-reader (Latin-1, garbles non-ASCII) when jsQR fails to find a code.
  • Add long-press on an entry's issuer/account name in the popup: opens edit mode and focuses/selects that field for a quick rename, instead of requiring the header's edit toggle first.

Test plan

  • Load the unpacked extension from the chrome/ build output
  • Import a QR image (including a Google Authenticator batch-export QR) with Chinese issuer/account names, confirm they display correctly
  • Long-press an entry's name in the popup, confirm edit mode opens and the field is focused and selected

Two independent decode bugs both mangled non-ASCII issuer/account names:
- migration.ts decoded the Google Authenticator export protobuf's
  account/issuer bytes with String.fromCharCode (Latin-1), instead of
  UTF-8.
- QrImport.vue/content.ts preferred the qrcode-reader library, which
  also decodes QR byte-mode data as Latin-1, over jsQR (UTF-8-correct),
  only falling back to jsQR on outright decode failure.
Long-pressing the issuer or account text now enables the existing edit
mode and focuses/selects that entry's rename input, instead of
requiring the user to open edit mode from the header first.
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

Successfully merging this pull request may close these issues.

1 participant