Menu

## Hanzi extends QRDataModeAbstract
in package

Hanzi.php : 31

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

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

Hanzi.php : 34
`public mixed ENCODING = 'GB18030'`

#### GB2312_SUBSET

Hanzi.php : 35
`public mixed GB2312_SUBSET = 0b1`

### Properties

#### $data

QRDataModeAbstract.php : 28

The data to write

`protected string $data`

#### $datamode

Hanzi.php : 40

the current data mode: Num, Alphanum, Kanji, Hanzi, Byte

`protected static int $datamode = \chillerlan\QRCode\Common\Mode::HANZI`

##### Tags

inheritDoc

### Methods

#### __construct()

QRDataModeAbstract.php : 35

QRDataModeAbstract constructor.

`public __construct(string $data) : mixed`

##### Parameters

$data : string

##### Tags

throws
  QRCodeDataException

##### Return values

mixed —

#### convertEncoding()

Hanzi.php : 59

encoding conversion helper

`public static convertEncoding(string $string) : string`

##### Parameters

$string : string

##### Tags

inheritDoc

##### Return values

string —

#### decodeSegment()

Hanzi.php : 160

See specification GBT 18284-2000

`public static decodeSegment(BitBuffer $bitBuffer, int $versionNumber) : string`

##### Parameters

$bitBuffer : BitBuffer
$versionNumber : int

##### Tags

throws
  QRCodeDataException

##### Return values

string —

#### getDataMode()

QRDataModeAbstract.php : 55

returns the current data mode constant

`public getDataMode() : int`

##### Tags

inheritDoc

##### Return values

int —

#### getLengthInBits()

Hanzi.php : 52
`public getLengthInBits() : int`

##### Tags

inheritDoc

##### Return values

int —

#### validateString()

Hanzi.php : 84

checks if a string qualifies as Hanzi/GB2312

`public static validateString(string $string) : bool`

##### Parameters

$string : string

##### Return values

bool —

#### write()

Hanzi.php : 123
`public write(BitBuffer $bitBuffer, int $versionNumber) : void`

##### Parameters

$bitBuffer : BitBuffer
$versionNumber : int

##### Tags

inheritDoc
throws
  QRCodeDataException

  on an illegal character occurence

##### Return values

void —

#### getCharCount()

Hanzi.php : 45

returns the character count of the $data string

`protected getCharCount() : int`

##### Tags

inheritDoc

##### Return values

int —

#### getLengthBits()

QRDataModeAbstract.php : 69

shortcut

`protected static getLengthBits(int $versionNumber) : int`

##### Parameters

$versionNumber : int

##### Return values

int —

## Search results