Bug #64057 [Com]: substr_replace failed charset utf-8
Edit report at https://bugs.php.net/bug.php?id=64057&edit=1
ID: 64057
Comment by: ltsujiguchi at gmail dot com
Reported by: ltsujiguchi at gmail dot com
Summary: substr_replace failed charset utf-8
Status: Open
Type: Bug
Package: Strings related
Operating System: Ubuntu 12.10
PHP Version: 5.4.11
Block user comment: N
Private report: N
New Comment:
Using echo bin2hex($cond);
Return:
6e6f74696369612e6e6f74696369615f746974756c6f204c494b452025c3a925204f52206e6f74696
369615f6e6f74696369615f636f6e746575646f204c494b4525c3a9253f
Previous Comments:
------------------------------------------------------------------------
[2013-01-26 13:50:36] ltsujiguchi at gmail dot com
Update comment above: [2013-01-26 13:37 UTC] ltsujiguchi at gmail dot com
Using source in gedit new file
Manually
<?php
$replacement = '%éééééááááá%';
$cond = 'noticia.noticia_titulo LIKE ? OR noticia.noticia_conteudo LIKE ?';
$posItem = stripos($cond, '?');
$cond = substr_replace($cond, $replacement, $posItem, 1);
$posItem = stripos($cond, '?');
$cond = substr_replace($cond, $replacement, $posItem, 1);
echo $cond;
?>
Result:
noticia.noticia_titulo LIKE %éééééááááá% OR
noticia.noticia_cont%éééééááááá%udo
LIKE ?
------------------------------------------------------------------------
[2013-01-26 13:42:04] ltsujiguchi at gmail dot com
Concatenating solved using substr.
------------------------------------------------------------------------
[2013-01-26 13:37:29] ltsujiguchi at gmail dot com
Use NetBeans 7.2 using codification UTF-8.
Outher problem using:
$replacement = '%ééééáááá%';
Result approximate:
noticia.noticia_titulo LIKE %é% OR noticia.noticia_conteudo L%é%IKE ?
------------------------------------------------------------------------
[2013-01-24 03:45:05] aharvey@php.net
Works fine for me too. Can you upload the entire file (preferably without
copy/pasting), please?
------------------------------------------------------------------------
[2013-01-23 21:46:03] mail+php at requinix dot net
Do you have one of those weird editors where shift+space produces something
besides a regular space? It may sound stupid and probably won't change anything
but try deleting the "LIKE ?" and typing it again carefully.
Also stupid and pointless, check that
echo bin2hex($cond);
ends in "...4c494b45203f".
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64057
--
Edit this bug report at https://bugs.php.net/bug.php?id=64057&edit=1
Thread (12 messages)
- ltsujiguchi at gmail dot com
- krakjoe@php.netBug #64057 [Opn]: substr_replace failed charset utf-8
- mail+php at requinix dot netBug #64057 [Com]: substr_replace failed charset utf-8
- aharvey@php.netBug #64057 [Opn->Fbk]: substr_replace failed charset utf-8
- ltsujiguchi at gmail dot comBug #64057 [Com]: substr_replace failed charset utf-8
- ltsujiguchi at gmail dot comBug #64057 [Fbk->Opn]: substr_replace failed charset utf-8
- ltsujiguchi at gmail dot comBug #64057 [Com]: substr_replace failed charset utf-8
- ltsujiguchi at gmail dot comBug #64057 [Com]: substr_replace failed charset utf-8
- datibbaw@php.netBug #64057 [Opn]: substr_replace failed charset utf-8
- yohgaki@php.netBug #64057 [Opn->Fbk]: substr_replace failed charset utf-8
- php-bugs at lists dot php dot netBug #64057 [Fbk->NoF]: substr_replace failed charset utf-8
- php-bugs at lists dot php dot netBug #64057 [Fbk->NoF]: substr_replace failed charset utf-8