I recently downloaded and installed ZendServer for IBM i. Everything is working great so far, but when I go to pull data from our database and display it on the webpage, it seems it's not converting from EBCDIC to ASCII. Here is the sample program I am working with:
- Code: Select all
<html>
<table width="75%" border="1" cellspacing="1" cellpadding="1" bgcolor="#eeeeee">
<tr> <td><b> Code</b></td> </tr>
<?php
//Establish connection to database
$conn = db2_connect ("*LOCAL", "", "");
$query = "Select * from RECLIB.OPNQINP";
//Execute query
$queryexe = db2_exec($conn, $query) ;
//Fetch results
while(db2_fetch_row($queryexe)) {
$data = db2_result($queryexe, 'OPNQINP');
//Put the results in an HTML table.
print("<tr bgcolor=#ffffff>\n");
print("<td>$data</td>\n");
print("</tr>\n");
}
?>
</table>
</html>
Here is the contents of the file OPNQINP:
- Code: Select all
00100This is test record 1
00200This is test record 2
00300This is test record 3
00400This is test record 4
00500This is test record 5
This is the output I receive on the webpage:
- Code: Select all
Code
ððñðð㈉¢@‰¢@£…¢£@™…ƒ–™„@ñ@@@@@@@@@@@@@@@@@@@@@@@@
ððòðð㈉¢@‰¢@£…¢£@™…ƒ–™„@ò@@@@@@@@@@@@@@@@@@@@@@@@
ððóðð㈉¢@‰¢@£…¢£@™…ƒ–™„@ó@@@@@@@@@@@@@@@@@@@@@@@@
ððôðð㈉¢@‰¢@£…¢£@™…ƒ–™„@ô@@@@@@@@@@@@@@@@@@@@@@@@
ððõðð㈉¢@‰¢@£…¢£@™…ƒ–™„@õ@@@@@@@@@@@@@@@@@@@@@@@@
Is there a simple way to have it convert from EBCDIC to ASCII?
Thanks.

