C # Generate and parse two-dimensional code

Source: Internet
Author: User

Here are the two versions of the open source download for C # and Java:

C#:http://www.codeproject.com/articles/20574/open-source-qrcode-library

Java:https://github.com/zxing/zxing

I have only tested the C # version, the following is the test process encountered problems and solutions:

1, the first operation error message is as follows:

The error "ThoughtWorks.QRCode.Properties.Resources" does not contain the definition of "getresource"

Workaround:

Only need to put: "MemoryStream MemoryStream = new MemoryStream (Resources.getresource (fileName));" are modified to "MemoryStream MemoryStream = new MemoryStream ((byte[]) Resources.ResourceManager.GetObject (fileName));"

Through the above changes, the support for English is directly run to pass. There's no problem with generating and parsing.

At this time if you are input Chinese, after the run is unresponsive, then you need to modify the source code as follows:

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

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

Then run the generated two-dimensional code, for Chinese can be recognized!

This is the end of the sharing, the above solutions are collected by the network.

C # Generate and parse two-dimensional code

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.