Documentation

Hanzi extends QRDataModeAbstract
in package

FinalYes

Hanzi (simplified Chinese) mode, GBT18284-2000: 13-bit double-byte characters from the GB2312/GB18030 character set

Please note that this is not part of the QR Code specification and may not be supported by all readers (ZXing-based ones do).

Tags
see
https://en.wikipedia.org/wiki/GB_2312
see
http://www.herongyang.com/GB2312/Introduction-of-GB2312.html
see
https://en.wikipedia.org/wiki/GBK_(character_encoding)#Encoding
see
https://gist.github.com/codemasher/91da33c44bfb48a81a6c1426bb8e4338
see
https://github.com/zxing/zxing/blob/dfb06fa33b17a9e68321be151c22846c7b78048f/core/src/main/java/com/google/zxing/qrcode/decoder/DecodedBitStreamParser.java#L172-L209
see
https://www.chinesestandard.net/PDF/English.aspx/GBT18284-2000

Table of Contents

Constants

DATAMODE  = \chillerlan\QRCode\Common\Mode::HANZI
ENCODING  = 'GB18030'
possible values: GB2312, GB18030
GB2312_SUBSET  = 0b1

Properties

$data  : string
The data to write

Methods

__construct()  : mixed
QRDataModeAbstract constructor.
convertEncoding()  : string
encoding conversion helper
decodeSegment()  : string
See specification GBT 18284-2000
getLengthInBits()  : int
retruns the length in bits of the data string
validateString()  : bool
checks if a string qualifies as Hanzi/GB2312
write()  : static
writes the actual data string to the BitBuffer, uses the given version to determine the length bits
getCharCount()  : int
returns the character count of the $data string
getLengthBits()  : int
shortcut

Constants

DATAMODE

public mixed DATAMODE = \chillerlan\QRCode\Common\Mode::HANZI

ENCODING

possible values: GB2312, GB18030

public string ENCODING = 'GB18030'

GB2312_SUBSET

public int GB2312_SUBSET = 0b1
Tags
todo:

other subsets???

Properties

Methods

convertEncoding()

encoding conversion helper

public static convertEncoding(string $string) : string
Parameters
$string : string
Return values
string

decodeSegment()

See specification GBT 18284-2000

public static decodeSegment(BitBuffer $bitBuffer, int $versionNumber) : string
Parameters
$bitBuffer : BitBuffer
$versionNumber : int
Tags
throws
QRCodeDataException
Return values
string

getLengthInBits()

retruns the length in bits of the data string

public getLengthInBits() : int
Return values
int

validateString()

checks if a string qualifies as Hanzi/GB2312

public static validateString(string $string) : bool
Parameters
$string : string
Return values
bool

write()

writes the actual data string to the BitBuffer, uses the given version to determine the length bits

public write(BitBuffer $bitBuffer, int $versionNumber) : static
Parameters
$bitBuffer : BitBuffer
$versionNumber : int
Tags
inheritDoc
throws
QRCodeDataException

on an illegal character occurence

Return values
static

getCharCount()

returns the character count of the $data string

protected getCharCount() : int
Return values
int

getLengthBits()

shortcut

protected static getLengthBits(int $versionNumber) : int
Parameters
$versionNumber : int
Return values
int

        
On this page

Search results