Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

How can the lack of Unicode support in PHP affect a PHP web app?

share|improve this question
It means I'd never consider using it. –  dan_waterworth Feb 19 '11 at 8:20
@dan_waterworth: +1 I don't agree but your answer made my day XD –  Federico Culloca Feb 19 '11 at 12:13

3 Answers 3

up vote 11 down vote accepted

Any website that purports to be multi-lingual or to deal with documents or content that is not representable in Latin-1 is likely to be problematic if you don't have Unicode support.

  • For example, would be toast without Unicode.

Another problematic use-case is when content might contain mathematical and other symbols.

However, your example of Facebook suggests that in fact you can in fact "do" Unicode in PHP. Alternatively, is not implemented in PHP. Either way, the home page says:

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

and has lots of UTF-8 content.

OK, here's what the PHP doc for "String" says:

"A string is series of characters, therefore, a character is the same as a byte. That is, there are exactly 256 different characters possible. This also implies that PHP has no native support of Unicode. See utf8_encode() and utf8_decode() for some basic Unicode functionality."

So PHP does have Unicode support. It is just that "native strings" are not Unicode based.

So what it means is that if you need to deal with any language (or set of languages) that cannot be encode in an 8-bit character set, your PHP code is going to be more cumbersome at any point where it needs to process content as (real) characters.

share|improve this answer
Facebook is multilingual and is built in PHP. How is the lack of unicode problematic for them? –  Emanuil Rusev Feb 19 '11 at 8:03
Well perhaps PHP does support Unicode. I'm not the person who said it didn't. –  Stephen C Feb 19 '11 at 8:05
PHP can certainly output unicode text - bytes are bytes, after all. PHP really doesnt care if you are sending a PNG image or UTF8 text. But PHP's string types and string functions wont necessarily work with unicode correctly. –  GrandmasterB Feb 19 '11 at 8:17
It's not that PHP (and other languages) can't support Unicode, they just do it poorly. –  delnan Feb 19 '11 at 11:35
@Bernard - I doubt that it is the kind of thing that can be addressed in a framework. The problem is that any code that you write "within the framework" that has to deal with character data has to do it in a unicode-aware way. If you are going to address this, it would need to be something like the configuration option mentioned by DoPPler. The change has to happen at the core language / interpreter level. –  Stephen C May 23 '13 at 6:51

Actually php has methods to manipulate multi byte strings - please see mbstring. There is also a configuration option in php.ini to use mbstring replacements for most (all) of the string manipulation functions - for details on that please see mbstring overload.

share|improve this answer

It means that you have to take some shortcuts and do nasty tricks in order to get unicode. And that those tricks are going to make the code more cumbersome and less readable.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.