PHP string encoding

This section describes important information about the handling of PHP strings in IBM® WebSphere® sMash.

PHP 5 uses PHP strings to represent two kinds of data: binary data such as a Jpeg image and textual data. The PHP 5 language does not provide a mechanism for a script author to define the string encoding that is used by a program. This is handled explicitly by the script rather than by the runtime.

Runtime Encoding.

In order to ease the interaction with Java™, the WebSphere sMash runtime for PHP provides runtime encoding. Runtime encoding is used when a PHP string is converted into a Java string. Internally, the PHP runtime preserves the ability to store binary data in a PHP string, which is essential for full support of the PHP 5 language. The runtime encoding is used when a PHP string is explicitly converted to a Java string, such as when it is stored in the global context as described in PHP global context reference. The runtime encoding can be set in the php.ini configuration file.

Script Encoding

The WebSphere sMash runtime for PHP also introduces the concept of script encoding. Script encoding defines how the script file is encoded. This must be correctly set in order for string literals, and PHP names such as function, variable and class names to be correctly parsed by the runtime. The script encoding can be set in the php.ini configuration file.

Version 1.1.31300