i need to create a QR-Code with UTF-8 encoding for creating a swiss QR-Bill.
The created QR-Code can be validated via a website, but i'm not allowed to post URLs
The image of the code can simply be inserted by drag and drop.
A Sample created from my code is added as an attachment "test.png"
The Problem is, that german special charachters are not readed correct.
I'm using the following code snipped to create the barcode:
The convertion to utf8 is from microsoft.
- Code: Select all
Dim unicodeString = "äüö?'#'ßÄÖÜ"
Dim unicodeBytes = Encoding.Unicode.GetBytes(unicodeString)
Dim utf8Bytes = Encoding.Convert(Encoding.Unicode, Encoding.UTF8, unicodeBytes)
Dim utf8Chars(Encoding.UTF8.GetCharCount(utf8Bytes, 0, utf8Bytes.Length - 1)) As Char
Encoding.UTF8.GetChars(utf8Bytes,0,utf8Bytes.Length,utf8Chars,0)
Dim utf8String As New String(utf8Chars)
Dim settings As New BarcodeSettings()
settings.Type = BarCodeType.QRCode
settings.QRCodeDataMode = QRCodeDataMode.Byte
settings.QRCodeECL = QRCodeECL.H
settings.X = 2.0F
settings.Data = utf8String
settings.Data2D = utf8String
Dim generator As New BarCodeGenerator(settings)
Dim image = generator.GenerateImage()
image.Save("test.png")
I'm using the latest version 6.6.3 of spire.barcode.
Did I miss any settings or something else to create a correct utf-8 encoded QR-code?