ASP. NET QRCode problems when creating Web QR codes!

Source: Internet
Author: User

12 Reviews

C # QRCode is an open source QR code generation Class Library, the project address is: Http://www.codeproject.com/Articles/20574/Open-Source-QRCode-Library

A project on hand today needs to add the ability to dynamically generate two-dimensional code, so we have a little research on this kind of library and encountered a problem. When I recompile qrcodelib this class library to error!

The error message is:

ERROR 7 "ThoughtWorks.QRCode.Properties.Resources" does not contain the definition of "getresource" D:\QRCode\QRCodeLib\QRCodeEncoder.cs 735 Qrcodelib

View related code, is a dynamic splicing file name, dynamically read the relevant "configuration file" a function, the code is as follows:

Just change these three wrong places to:

MemoryStream MemoryStream = new MemoryStream ((byte[]) Resources.ResourceManager.GetObject (fileName);

You can do it.

In addition, my project is the web, found that I downloaded the QRCode project file Qrcodewebapp inside does not write related functions! In fact, it is very simple, directly take qrcodesampleapp inside the key core code to change it, the last bar!

The above ignores a problem, QRCode created two-dimensional code problem, that is, Chinese garbled! It was not noticed at the beginning that the final stage was discovered, but also blamed for his carelessness.

In fact, it is very simple, still need to modify the qrcodelib inside a little bit of code.

1. Modify QRCodeEncoder.cs and QRCodeDecoder.cs to replace Encoding.unicode with Encoding.UTF8

UnicodeEncoding encoding = new UnicodeEncoding () in QRCodeUtility.cs in 2.util directory, replace with utf8encoding encoding = new UTF8Encoding ();

The two-dimensional code will be able to identify the Chinese!

Attach your own revised version below, download/upfiles/self/sean-qrcode.rar here

The change is that the code is all replaced with UTF8,

Dlsaint Problem Solving:

ASP. NET QRCode problems when creating Web QR codes!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.