After upgrading to Zend Server 8 for IBM i, international characters may not display correctly

Follow

Issue

Starting with Zend Server 8 for IBM i with PHP 5.6, the default_charset PHP directive is set to UTF-8, which causes the browser to show all pages using UTF-8 encoding.  This is the new default for PHP 5.6.  This can cause pages encoded with ISO-8859-1 to display international characters incorrectly.  Since the document root is distributed with ISO-8859-1 (CCSID 819) as the default CCSID, many PHP scripts are also encoded this way, as they inherit the encoding from the directory default.

This article tells how to set Zend Server for IBM i to not have a default character set, so that pages can display correctly with either encoding.

Note: If the upgrade is to 8.5 or higher, please also check this article:

Environment

Zend Server for IBM i version 8 or later, with PHP version 5.6 or later, running on any supported version of IBM i.

Resolution

To check if you have this problem, try using this simple script:

<?php
echo 'Example of national characters<br>';
echo 'Æ<br>';
echo 'Ø<br>';
echo 'Å';
?>

If the characters do not display correctly, check the encoding used by your browser when you are viewing the page.  For example, in Firefox you would go to View -> Character Encoding, and look to see which encoding is selected.  If the browser is using Unicode encoding, please try selecting Western.  Then your characters should appear correctly.

You can change PHP to not force the browser to use UTF-8.  You can make this change in the Zend Server UI, at the url formatted like this:

http://<your IBM i IP address>:10081

In the above example, you would replace "<your IBM i IP address>" with the actual IP address for your IBM i.

In the Zend Server UI, please go to the Configurations -> PHP tab. In the list, please find 'Data Handling', and give it one single click. It should expand to show you the directives, although it may lag a bit, so please be careful not to give it a second click, which will tell it to collapse again.

Once you see the directives for Data Handling, look down the first column to find default_charset. It is about the fourth one down. It is currently set to UTF-8. Blank it out, then click the Save button in the upper left. After saving, you will be prompted to restart. This will stop your web site for a couple of minutes, so please plan for the interruption.

Once the web site has restarted, please go view your script in the browser. The characters should appear correctly, and the browser should show the page encoding as Western. You might need to clear the browser cache, which you can do by closing the browser window and opening a new one.

Details

The default_charset directive is PHP_INI_ALL, so you can change it for just a directory or just a single script, if you do not feel comfortable changing it for the whole web site:

PHP: Description of core php.ini directives

To change the directive for a given directory, please use the .user.ini file (.htaccess does not work for PHP directives with FastCGI):

PHP: .user.ini files

To change the directive for a single script, use header():

PHP: header

To see which CCSID a directory or file uses in the IFS, you can display the file or directory using the WRKLNK command from the 5250 command line.  Use option 8 to display the attributes, and look at the "Coded character set ID" attribute.

Common CCSID's are 819 for ISO-8859-1, 1252 for Windows Latin 1 (very similar to 819), and 1208 for UTF-8 encoding.  You can see a list of CCSID values here:

CCSID values defined on IBM i

Have more questions? Submit a request

Comments

  • Avatar
    Michelle Orwin

    I am attempting to overhaul our Zend Server 6.3 IBM I freely release and looking into about the new form of Zend server. Zend server 8 resembles that it as of now turned out from the past Beta adaptation to now the genuine rendition. pay someone to do your assignment. At that point it has two choices as PHP5.5 and PHP5.6.

Powered by Zendesk