Re: How can a UTF-8 string can be converted to an array of Bytes?
| From: | Eric Butera | Date: | Wed, 25 May 2011 14:31:37 +0000 |
| Subject: | Re: How can a UTF-8 string can be converted to an array of Bytes? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313153@lists.php.net to get a copy of this message | ||
On Wed, May 25, 2011 at 8:15 AM, Eli Orr (Office) <eli.orr@logodial.com> wrote:
> Hi,
>
> Since a UTF-8 is a multi-bytes mechanism I get for 2 or 3 bytes UTF-8
> encoded character a single character
>
> How can it be break into the REAL bytes array that represent the UTF-8
> string
> and how can we reassembled the bytes array back to UTF-8?
>
> --
> Best Regards,
>
> *Eli Orr*
> CTO & Founder
> *LogoDial Ltd.*
>
> __
>
You can use mb_substr [1] with a UTF-8 encoding to get the single characters.
http://us.php.net/mb_substr