Skip to content

Comments

Set UTF-8 encoding for QR code generation to support Unicode characters#33

Draft
Copilot wants to merge 4 commits intopublicfrom
copilot/fix-qrcode-unicode-handling
Draft

Set UTF-8 encoding for QR code generation to support Unicode characters#33
Copilot wants to merge 4 commits intopublicfrom
copilot/fix-qrcode-unicode-handling

Conversation

Copy link

Copilot AI commented Jan 22, 2026

ZXing.Net defaults to ISO-8859-1 encoding when no CHARACTER_SET hint is specified. Unicode characters outside the Latin-1 range (U+0000-U+00FF) get replaced with ? (0x3F), causing emojis like 😎 (U+1F60E) to encode as 3F 3F instead of proper UTF-8 bytes F0 9F 98 8E.

Changes

  • Set CHARACTER_SET hint to "UTF-8" for QR_CODE format before encoding in EncodePage.xaml.cs
// Set UTF-8 encoding to properly handle Unicode characters (e.g., emojis)
if (writer.Format == BarcodeFormat.QR_CODE)
{
    writer.Options.Hints[EncodeHintType.CHARACTER_SET] = "UTF-8";
}

Other barcode formats remain unaffected.

Original prompt

This section details on the original issue you should resolve

<issue_title>QR code generator doesn't properly hande Unicode characters</issue_title>
<issue_description>Hi,

I noticed when trying to create a QR code that contains Unicode 6 character 😎 the QR generated outputs data

3F 3F and later on tested that any Unicode emoji results in 3F 3F

and a QR generator on my browser outputs

F0 9F 98 8E which is the correct hex data for U+1F60E

Both are on error correction H

Image barcodrod.io QR

Image browser extension QR

edit: tested that the program can decode QR correctly from image file and display the Unicode character on the lower QR code

--
Version: 1.8.1.0 (Windows store)</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 22, 2026 06:59
…aracters

Co-authored-by: MarkHopper24 <106134632+MarkHopper24@users.noreply.github.com>
…dding CHARACTER_SET

Co-authored-by: MarkHopper24 <106134632+MarkHopper24@users.noreply.github.com>
Co-authored-by: MarkHopper24 <106134632+MarkHopper24@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix QR code generator to handle Unicode characters properly Set UTF-8 encoding for QR code generation to support Unicode characters Jan 22, 2026
Copilot AI requested a review from MarkHopper24 January 22, 2026 07:04
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.

QR code generator doesn't properly hande Unicode characters

2 participants