codebude / QRCoder

A pure C# Open Source QR Code implementation
MIT License
4.46k stars 1.09k forks source link

Adding TAB between strings #406

Closed KayakFisher205 closed 3 months ago

KayakFisher205 commented 2 years ago

Type of issue

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

Expected Behavior

I'm looking to take 2 strings and put 2 TABs between the strings, then create the QR Code.

Current Behavior

I've tried string.Format("{0}{1}{1}{2}",string1,"\t",string2) and string.Format("{0}{1}{1}{2}",string1,(char)9,string2) but so far, it just scans without the TABs.

I found an online QR generator where I was able to create a QR Code that does have them. I am just not sure how to do it in QRCoder.

Steps to Reproduce (for bugs)

QRCodeData qrCodeData = qrGenerator.CreateQrCode(string.Format("{0}{1}{1}{2}", grade, "\t", value), QRCodeGenerator.ECCLevel.Q); var imgType = Base64QRCode.ImageType.Jpeg; Base64QRCode qrCode = new Base64QRCode(qrCodeData); return string.Format("data:image/{0};base64,{1}" , imgType.ToString().ToLower(), qrCode.GetGraphic(2, Color.Black, Color.White, true, imgType));

Your Environment

Below is the data used to create the correct QR code from an Online site. image

h4rdmol commented 1 year ago

@KayakFisher205 from the code that you wrote it doesn't look like it will work. Because of typos. In any case, please try to use a preformatted string.

string myString = string.Format("{0}{1}{1}{2}", grade, "\t", value); QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeData qrCodeData = qrGenerator.CreateQrCode(myString, QRCodeGenerator.ECCLevel.Q); QRCode qrCode = new QRCode(qrCodeData); Bitmap qrCodeImage = qrCode.GetGraphic(20);

codebude commented 3 months ago

Can't reproduce the problem. Tabs should be encoded. If this is still a thing, please re-open the issue @KayakFisher205 .