php vs python

Michael Fesser netizen at gmx.de
Fri May 23 08:29:34 EDT 2008


.oO(Duncan Booth)

>On those rare occasions when I've helped someone who wanted advice I've 
>found that my Python oriented viewpoint can be quite hard to translate to 
>PHP. For example I'd suggest 'oh you just encode that as utf8' only to be 
>told that there's no easy way to do that (have just Google'd it looks like 
>there is now a way to do that but with a big red warning about it being 
>EXPERIMENTAL and only use at your own risk).
>
>(Looking at the example given for unicode_encode it appears to depend for 
>its working on a global setting which isn't included in the example. I may 
>have misunderstood the example but if I read that correctly its a good 
>example of why PHP doesn't fit my brain.)

The only little problem is that PHP doesn't have native Unicode support
yet, which will change with PHP 6. But of course you can still use UTF-8
without any trouble, I do it all the time. You just have to keep in mind
that many string functions still work on bytes, not on characters, but
this can almost always be solved with the Multibyte extension. Apart
from that there's no problem with PHP and UTF-8. It's also easily
possible to convert between various encodings using the iconv extension.

Micha



More information about the Python-list mailing list