|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-02-04 07:36 UTC] moriyoshi@php.net
[2003-02-04 21:20 UTC] jc at mega-bucks dot co dot jp
[2003-02-05 07:47 UTC] moriyoshi@php.net
[2003-02-05 07:55 UTC] jc at mega-bucks dot co dot jp
[2003-02-05 08:27 UTC] moriyoshi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 14:00:01 2025 UTC |
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 ... ??????Ρ?Ķ-?Դ֤Υ?????ץ?????ģء?³???о졪?????κ??Ԥ??ΤǤϤ?????�