From: [EMAIL PROTECTED]
Operating system: Red Hat Linux 7.2
PHP version: 4.3.0
PHP Bug Type: mbstring related
Bug description: mb_substr produces "mojibake" on certain strings ...
First, sorry for any offensive japanese words. I can't read/write japanese
very well, and the error in mb_substr occurs on data from a list of video
titles ... I tried to find another less offensive example but couldn't.
I'm just posting this bug report in order to help ...
I am trying to use mb_substr on data I get from a postgreSQL DB and in
some cases mb_substr seems to cut the string in the middle of a multibyte
char .. which turns the "cut" char into mojibake ...
The DB is in EUC-JP and my internal encoding is set to EUC-JP in my
php.ini file ...
As you can see the last character of the string has been improperly cut
...
Here is my test program and output:
CODE:
<?php
require_once("db_functions/sql_query.inc");
$sql = "select maker_comment from products where id=12802";
$res = sql_query($sql);
$dat = pg_fetch_object($res);
$c = $dat->substr;
echo "String: <BR>";
echo $c ."<BR>";
$c = mb_substr($c, 0, 80);
echo "<BR> After cutting it ... <BR>";
echo $c ."<BR>";
?>
OUPUT:
COMMENT2:
����Ρ�Ķ-�Դ֤Υ���ץ�����ģء�³���о졪�����κ��Ԥ�ΤǤϤ���ޤ���;ʬ�ʲ褬�ʤ�
AFTER cutting it ...
����Ρ�Ķ-�Դ֤Υ���ץ�����ģء�³���о졪�����κ��Ԥ�ΤǤϤ�����
--
Edit bug report at http://bugs.php.net/?id=22041&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22041&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22041&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22041&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22041&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22041&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22041&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22041&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22041&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22041&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22041&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22041&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22041&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22041&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22041&r=gnused