Hanzi
extends QRDataModeAbstract
in package
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
Table of Contents
- ENCODING = 'GB18030'
- GB2312_SUBSET = 0b1
- $data : string
- The data to write
- $datamode : int
- the current data mode: Num, Alphanum, Kanji, Hanzi, Byte
- __construct() : mixed
- QRDataModeAbstract constructor.
- convertEncoding() : string
- encoding conversion helper
- decodeSegment() : string
- See specification GBT 18284-2000
- getDataMode() : int
- returns the current data mode constant
- getLengthInBits() : int
- validateString() : bool
- checks if a string qualifies as Hanzi/GB2312
- write() : void
- getCharCount() : int
- returns the character count of the $data string
- getLengthBits() : int
- shortcut
Constants
ENCODING
public
mixed
ENCODING
= 'GB18030'
GB2312_SUBSET
public
mixed
GB2312_SUBSET
= 0b1
Properties
$data
The data to write
protected
string
$data
$datamode
the current data mode: Num, Alphanum, Kanji, Hanzi, Byte
protected
static int
$datamode
= \chillerlan\QRCode\Common\Mode::HANZI
Tags
Methods
__construct()
QRDataModeAbstract constructor.
public
__construct(string $data) : mixed
Parameters
- $data : string
Tags
Return values
mixed —convertEncoding()
encoding conversion helper
public
static convertEncoding(string $string) : string
Parameters
- $string : string
Tags
Return values
string —decodeSegment()
See specification GBT 18284-2000
public
static decodeSegment(BitBuffer $bitBuffer, int $versionNumber) : string
Parameters
- $bitBuffer : BitBuffer
- $versionNumber : int
Tags
Return values
string —getDataMode()
returns the current data mode constant
public
getDataMode() : int
Tags
Return values
int —getLengthInBits()
public
getLengthInBits() : int
Tags
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()
public
write(BitBuffer $bitBuffer, int $versionNumber) : void
Parameters
- $bitBuffer : BitBuffer
- $versionNumber : int
Tags
Return values
void —getCharCount()
returns the character count of the $data string
protected
getCharCount() : int
Tags
Return values
int —getLengthBits()
shortcut
protected
static getLengthBits(int $versionNumber) : int
Parameters
- $versionNumber : int