\PhpZip\Model\Extra\FieldsUnicodePathExtraField

Info-ZIP Unicode Path Extra Field (0x7075): ==========================================.

Stores the UTF-8 version of the file name field as stored in the local header and central directory header. (Last Revision 20070912)

Value Size Description


(UPath) 0x7075 Short tag for this extra block type ("up") TSize Short total data size for this block Version 1 byte version of this extra field, currently 1 NameCRC32 4 bytes File Name Field CRC32 Checksum UnicodeName Variable UTF-8 version of the entry File Name

Currently Version is set to the number 1. If there is a need to change this field, the version will be incremented. Changes may not be backward compatible so this extra field should not be used if the version is not recognized.

The NameCRC32 is the standard zip CRC32 checksum of the File Name field in the header. This is used to verify that the header File Name field has not changed since the Unicode Path extra field was created. This can happen if a utility renames the File Name but does not update the UTF-8 path extra field. If the CRC check fails, this UTF-8 Path Extra Field should be ignored and the File Name field in the header should be used instead.

The UnicodeName is the UTF-8 version of the contents of the File Name field in the header. As UnicodeName is defined to be UTF-8, no UTF-8 byte order mark (BOM) is used. The length of this field is determined by subtracting the size of the previous fields from TSize. If both the File Name and Comment fields are UTF-8, the new General Purpose Bit Flag, bit 11 (Language encoding flag (EFS)), can be used to indicate that both the header File Name and Comment fields are UTF-8 and, in this case, the Unicode Path and Unicode Comment extra fields are not needed and should not be created. Note that, for backward compatibility, bit 11 should only be used if the native character set of the paths and comments being zipped up are already in UTF-8. It is expected that the same file name storage method, either general purpose bit 11 or extra fields, be used in both the Local and Central Directory Header for a file.

Summary

Methods
Properties
Constants
__construct()
getCrc32()
setCrc32()
getUnicodeValue()
setUnicodeValue()
unpackLocalFileData()
unpackCentralDirData()
packLocalFileData()
packCentralDirData()
getHeaderId()
__toString()
No public properties found
DEFAULT_VERSION
HEADER_ID
No protected methods found
No protected properties found
N/A
No private methods found
$crc32
$unicodeValue
N/A

Constants

DEFAULT_VERSION

DEFAULT_VERSION = 0x1

HEADER_ID

HEADER_ID = 0x7075

Properties

$crc32

$crc32 : int

Type

int

$unicodeValue

$unicodeValue : string

Type

string

Methods

__construct()

__construct(int  $crc32, string  $unicodeValue) : mixed

Parameters

int $crc32
string $unicodeValue

Returns

mixed —

getCrc32()

getCrc32() : int

Returns

int —

the CRC32 checksum of the filename or comment as encoded in the central directory of the zip file

setCrc32()

setCrc32(int  $crc32) : mixed

Parameters

int $crc32

Returns

mixed —

getUnicodeValue()

getUnicodeValue() : string

Returns

string —

setUnicodeValue()

setUnicodeValue(string  $unicodeValue) : mixed

Parameters

string $unicodeValue

the UTF-8 encoded name to set

Returns

mixed —

unpackLocalFileData()

unpackLocalFileData(string  $buffer, \PhpZip\Model\ZipEntry|null  $entry = null) : static

Populate data from this array as if it was in local file data.

Parameters

string $buffer

the buffer to read data from

\PhpZip\Model\ZipEntry|null $entry

Throws

\PhpZip\Exception\ZipException

on error

Returns

static —

unpackCentralDirData()

unpackCentralDirData(string  $buffer, \PhpZip\Model\ZipEntry|null  $entry = null) : static

Populate data from this array as if it was in central directory data.

Parameters

string $buffer

the buffer to read data from

\PhpZip\Model\ZipEntry|null $entry

Throws

\PhpZip\Exception\ZipException

on error

Returns

static —

packLocalFileData()

packLocalFileData() : string

The actual data to put into local file data - without Header-ID or length specifier.

Returns

string —

the data

packCentralDirData()

packCentralDirData() : string

The actual data to put into central directory - without Header-ID or length specifier.

Returns

string —

the data

getHeaderId()

getHeaderId() : int

Returns the Header ID (type) of this Extra Field.

The Header ID is an unsigned short integer (two bytes) which must be constant during the life cycle of this object.

Returns

int —

__toString()

__toString() : string

Returns

string —