How can I work with unicode in PHP without the mbstring extension

I use a public hosting service to host my site, so I can’t get direct access to PHP settings or install any extension. So my problem is with utf-8 strings that cannot be handled by standard PHP string functions, since I don't have the mbstring extension installed on the server. I am looking for another way to deal with unicode strings, any help or guidance is much appreciated or if you know about any online resources, please share them with me.

+5
source share
2 answers

There is a PHP UTF-8 library in Sourceforge - maybe enough for your needs. In addition, preg_*functions are usually taken /uindependently of mbstring.

In the long run, I agree that it's time to start looking for a more modern host. Mbstring is currently a basic need, as a host that lacks this should be asked what else might be lost.

+6
source

if you have no choice but to stick to this host and you cannot turn your hands in providing mbstring (c'mon, php w / o mbstring, for example, sooo 1999 [*]), then can you use the intl pecl extension ? which plus what you can do with PCRE and iconv might be enough.

intl , , :

  • grapheme_extract - , UTF-8.

  • grapheme_stripos - ( )

  • grapheme_stristr - .

  • grapheme_strlen -

  • grapheme_strpos - ( )

  • grapheme_strripos - ( )

  • grapheme_strrpos - ( )

  • grapheme_strstr - .

  • grapheme_substr -

[*] teenspeak

+2

All Articles