Bug->Doc #63079 [Opn->Asn]: String access by character is not multibyte-safe
| From: | aharvey@php.net | Date: | Wed, 14 Nov 2012 02:03:37 +0000 |
| Subject: | Bug->Doc #63079 [Opn->Asn]: String access by character is not multibyte-safe | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9118@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63079&edit=1
ID: 63079
Updated by: aharvey@php.net
Reported by: astatutov at gmail dot com
Summary: String access by character is not multibyte-safe
-Status: Open
+Status: Assigned
-Type: Bug
+Type: Documentation Problem
-Package: Strings related
+Package: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: aharvey
Block user comment: N
Private report: N
New Comment:
It does say right at the top of the string type page that a character is a byte, but I'll add a
warning to the character access section to be extra clear.
Previous Comments:
------------------------------------------------------------------------
[2012-11-13 10:49:20] Matti dot jarvinen at nitroid dot fi
Under "String access and modification by character" at
http://php.net/manual/en/language.types.string.php
there is no mention about []
syntax not being multibyte safe.
At least make this a documentation issue.
------------------------------------------------------------------------
[2012-09-13 19:27:35] astatutov at gmail dot com
*mbstring* just determines which module will read this option. It doesn't say which module it
will affect. Say, option mbstring.func_overload affects whole php, because it overrides native
functions. Option mbstring.http_input changes default php behavior when reading HTTP-request and so
on. So why can't mbstring.func_overload or, say, mbstring.op_overload override the string
accessing operation?
------------------------------------------------------------------------
[2012-09-13 14:12:32] laruence@php.net
as the option self said *mbstring*.internal_encoding, not php.internal_encoding...
------------------------------------------------------------------------
[2012-09-13 11:57:39] astatutov at gmail dot com
> you should use mb_* to deal with multi-byte characters
I know it. I mentioned it in the description. The option mbstring.func_overload do it for me. But
bracket operator is still unusable: the documentation states it accesses the character while it
doesn't. And I believe it's not the documentation problem. Any modern language I know
which is able to work with utf-8 do it transparently for developer. The aim of mbstring is the same,
isn't it? Setting mbstring.internal_encoding to utf-8 a developer will expect that INTERNAL
string accessing operator will support it. This is what the term "predictable behavior"
means.
------------------------------------------------------------------------
[2012-09-13 10:48:25] laruence@php.net
yeah, it's not.
you should use mb_* to deal with multi-byte characters
------------------------------------------------------------------------
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=63079
--
Edit this bug report at https://bugs.php.net/bug.php?id=63079&edit=1