Documentation

Kanji extends QRDataModeAbstract
in package

FinalYes

Kanji mode: 13-bit double-byte characters from the Shift-JIS character set

ISO/IEC 18004:2000 Section 8.3.5 ISO/IEC 18004:2000 Section 8.4.5

Tags
see
https://en.wikipedia.org/wiki/Shift_JIS#As_defined_in_JIS_X_0208:1997
see
http://www.rikai.com/library/kanjitables/kanji_codes.sjis.shtml
see
https://gist.github.com/codemasher/d07d3e6e9346c08e7a41b8b978784952

Table of Contents

Constants

DATAMODE  = \chillerlan\QRCode\Common\Mode::KANJI
ENCODING  = 'SJIS'
possible values: SJIS, SJIS-2004

Properties

$data  : string
The data to write

Methods

__construct()  : mixed
QRDataModeAbstract constructor.
convertEncoding()  : string
encoding conversion helper
decodeSegment()  : string
reads a segment from the BitBuffer and decodes in the current data mode
getLengthInBits()  : int
retruns the length in bits of the data string
validateString()  : bool
checks if a string qualifies as SJIS Kanji
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::KANJI

ENCODING

possible values: SJIS, SJIS-2004

public string ENCODING = 'SJIS'

SJIS-2004 may produce errors in PHP < 8

Properties

Methods

convertEncoding()

encoding conversion helper

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

decodeSegment()

reads a segment from the BitBuffer and decodes in the current data mode

public static decodeSegment(BitBuffer $bitBuffer, int $versionNumber) : string
Parameters
$bitBuffer : BitBuffer
$versionNumber : int
Tags
inheritDoc
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 SJIS Kanji

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