NYCPHP Meetup

NYPHP.org

[nycphp-talk] Charsets are still driving me nuts

Brian D. brian at realm3.com
Thu Mar 6 11:03:34 EST 2008


Same thing goes for strlen(). It won't break, but it reports bytes, so
be aware any validation you're doing using strlen may break. Check out
mb_strlen() for an alternative.

http://us2.php.net/manual/en/function.mb-strlen.php

On Wed, Mar 5, 2008 at 7:25 PM, John Campbell <jcampbell1 at gmail.com> wrote:
> 2008/3/5 Cliff Hirsch <cliff at pinestream.com>:
>
> > Is there a downside to using utf-8?
>
>  No, but there are issues with some string functions.  In php4/5
>  functions like substr() operate on bytes, and may break UTF-8 strings
>  that contain multibyte characters.  I'd search your code for things
>  like "substr" and "pos", and make sure they are not operating on
>  userdata in an unsafe way.
>
>  see:
>  http://www.phpwact.org/php/i18n/utf-8
>
>  Regards,
>  John Campbell
>
>
> _______________________________________________
>  New York PHP Community Talk Mailing List
>  http://lists.nyphp.org/mailman/listinfo/talk
>
>  NYPHPCon 2006 Presentations Online
>  http://www.nyphpcon.com
>
>  Show Your Participation in New York PHP
>  http://www.nyphp.org/show_participation.php
>



-- 
realm3 web applications [realm3.com]
freelance consulting, application development
(917) 512-3594



More information about the talk mailing list