ClassLibraryWeiBao/QR二维码/DataEncodation/EightBitByteEncoder.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections;
namespace Gma.QrCodeNet.Encoding.DataEncodation
{
/// <summary>
/// EightBitByte is a bit complicate compare to other encoding.
/// It can accept several different encoding table from global ECI table.
/// For different country, default encoding is different. JP use shift_jis, International spec use iso-8859-1
/// China use ASCII which is first part of normal char table. Between 00 to 7E
/// Korean and Thai should have their own default encoding as well. But so far I can not find their specification freely online.
/// QrCode.Net will use international standard which is iso-8859-1 as default encoding.
/// And use UTF8 as suboption for any string that not belong to any char table or other encoder.
/// </summary>
/// <remarks>ISO/IEC 18004:2000 Chapter 8.4.4 Page 22</remarks>
internal class EightBitByteEncoder : EncoderBase
{
private const string _defaultEncoding = QRCodeConstantVariable.DefaultEncoding;
internal string Encoding {get; private set;}
/// <summary>
/// EightBitByte encoder's encoding will change according to different region
/// </summary>
/// <param name="encoding">Default encoding is "iso-8859-1"</param>
internal EightBitByteEncoder(string encoding)
:base()
{
Encoding = encoding ?? _defaultEncoding;
}
internal EightBitByteEncoder()
:base()
{
Encoding = _defaultEncoding;
}
internal override Mode Mode
{
get { return Mode.EightBitByte; }
}
protected byte[] EncodeContent(string content, string encoding)
{
byte[] contentBytes;
try
{
contentBytes = System.Text.Encoding.GetEncoding(encoding).GetBytes(content);
} catch (ArgumentException ex) {
throw ex;
}
return contentBytes;
}
/// <summary>
/// Bitcount, Chapter 8.4.4, P.24
/// </summary>
private const int EIGHT_BIT_BYTE_BITCOUNT = 8;
internal override BitList GetDataBits(string content)
后面还有 47 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。