I'm confused Steve, It cannot be both UTF-8 and CCSID 37. UTF-8 is CCSID 1208 - "Within IBM, UTF-8 has been registered as CCSID 1208 with growing character set (sometimes also referred to as code page 1208). As new characters are added to the standard, this number (1208) will not change." See https://www.ibm.com/support/knowledgecenter/en/SSEPGG_9.5.0/com.ibm.db2.luw.admin.nls.doc/doc/c0051306.html <https://www.ibm.com/support/knowledgecenter/en/SSEPGG_9.5.0/com.ibm.db2.luw.admin.nls.doc/doc/c0051306.html> for the full details.

I suspect you are getting some unwanted automatic conversion.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Apr 18, 2018, at 6:24 PM, Steve Richter <stephenrichter@xxxxxxxxx> wrote:

from PHP I insert the string " ci·ré " into an IBM i database table. The
text, with its characters, is stored correctly in the table. But then,
when I use PHP to read from the column, the text that returns has a number
of extra characters at the end of the string. How to read this field
correctly?

here is how the text I read displays in the browser:

ci·ré @�
when I use DSPPFM to display the data as it is stored it displays
correctly:
ci·ré and the hex codes: 8389 B3995140 40404040

the table was created using SQL. The CCSID of all the columns is 37.

here is the PHP. I am even using utf8_encode to convert from ascii to
utf8.

<?php

header("Content-type: text/html");
$collNum = isset($_GET["collNum"]) ? $_GET["collNum"]: '' ;
$libl = isset($_GET["libl"]) ? $_GET["libl"]: '' ;

echo $collNum . '<br>' ;
echo $libl . '<br>' ;

$sql = 'select a.collnum, a.styles from prugcoll a ' .
'where a.collnum = ?' ;

$options = array('i5_naming' => DB2_I5_NAMING_ON);
$options['i5_libl'] = 'couri7' ;
$conn = db2_connect("*LOCAL","","", $options);

$stmt = db2_prepare($conn, $sql) ;

db2_bind_param( $stmt, 1, "collNum", DB2_PARAM_IN ) ;

$result = db2_execute($stmt) ;
while( $row = db2_fetch_array( $stmt ))
{
$rt_collNum = $row[0];
$styles = $row[1] ;
$utf8_styles = utf8_encode($styles);

echo '<p>COLLNUM:' . $rt_collNum . '</p>' ;
echo '<p>STYLES:' . $styles . '</p>' ;
echo '<p>length STYLES:' . strlen(trim($styles)) . '</p>' ;
echo '<p>utf8 encoded STYLES:' . $utf8_styles . '</p>' ;
}

?>
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.