mbstring

PHP: mb_strtoupper not working

时光怂恿深爱的人放手 提交于 2019-12-05 09:14:37
I have a problem with UTF-8 and mb_strtoupper. mb_internal_encoding('UTF-8'); $guesstitlestring='Le Courrier de Sáint-Hyácinthe'; $encoding=mb_detect_encoding($guesstitlestring); if ($encoding!=='UTF-8') $guesstitlestring=mb_convert_encoding($guesstitlestring,'UTF-8',$encoding); echo "DEBUG1 $guesstitlestring\n"; $guesstitlestring=mb_strtoupper($guesstitlestring); echo "DEBUG2 $guesstitlestring\n"; Result: DEBUG1 Le Courrier de Sáint-Hyácinthe DEBUG2 LE COURRIER DE S?INT-HY?CINTHE I don't understand why this is happening? I'm trying to be as careful as I can with the encoding. The string is

PHP: Call to undefined function mb_strlen() - on custom compiled PHP with mbstring enabled

让人想犯罪 __ 提交于 2019-12-04 21:24:43
问题 I have this custom compiled PHP (v5.3.3) with the following extensions enabled (via configure): ./configure --prefix=/usr/local/php5.3.3 --with-config-file-path=/usr/local/apache2/conf --with-apxs2=/usr/local/apache2/bin/apxs --with-bz2 --with-curl=/usr/lib --with-curlwrappers --with-freetype-dir=/usr/local --with-gd=/usr/local --with-gettext --with-gmp --with-iconv=/usr/local --with-imap=/usr/local/imap2007e --with-imap-ssl --with-jpeg-dir=/usr/local/lib --with-kerberos --with-libxml-dir=

PHP mbstring doesn't work with Apache on Windows

梦想与她 提交于 2019-12-04 19:58:00
I have to get PHP 5.4 (32 bit, TS) with mbstring running with Apache 2.4 (32 bit) on Windows. In my httpd.conf I set this: PHPIniDir "c:/php54" LoadModule php5_module "c:/php54/php5apache2_4.dll" AddHandler application/x-httpd-php .php And in my php.ini: extension_dir = "ext" ... extension=php_mbstring.dll Now, when I execute php -m it correctly says that mbstring is loaded: ... libxml mbstring mcrypt ... And php -i spits out a section about mbstring: mbstring Multibyte Support => enabled Multibyte string engine => libmbfl HTTP input encoding translation => disabled libmbfl version => 1.3.2 ..

call to undefined function mb_strimwidth

一笑奈何 提交于 2019-12-04 03:34:43
Months ago I made a short code that uses mb_strimwidth() to exactly fit some text into a table cell, putting dots at the end of a truncated string. Now, after some times, I tried to execute that same code and it went out with this error: Fatal error: Call to undefined function mb_strimwidth() in ... I tried to find the mbstring.php file, and when I found the mb_strimwidth() function, I discovered that it is not implemented anymore. How is that possible? But my main question is: how can I get the same result as mb_strimwidth() ? I thought to rewrite the function using a loop and mb_strwidth() ,

iconv or mbstring?

橙三吉。 提交于 2019-12-04 02:27:53
Which multibyte-handling library should I use : iconv or mbstring ? After some Googling I didn't find enough arguments to convince me to use one particularly, and I could not get any benchmark (and I'm too lazy do create one :-p). After all maybe this choice doesn't really matters ? Thanks for any piece of advice. I tend to use a combination of both - depending on my needs. I use iconv to convert from one charset to another, but mbstring for simpler operations like mb_strtoupper() and mb_stristr(). But if only one of the libraries is needed I suggest using mbstring purely for it's widespread

PHP mb_substr() not working correctly?

天大地大妈咪最大 提交于 2019-12-04 00:00:00
This code print mb_substr('éxxx', 0, 1); prints an empty space :( It is supposed to print the first character, é . This seems to work however: print mb_substr('éxxx', 0, 2); But it's not right, because (0, 2) means 2 characters... Try passing the encoding parameter to mb_substr, as such: print mb_substr('éxxx', 0, 1, 'utf-8'); The encoding is never detected automatically. In practice I've found that, in some systems, multi-byte functions default to ISO-8859-1 for internal encoding. That effectively ruins their ability to handle multi-byte text. Setting a good default will probably fix this and

PHP: Call to undefined function mb_strlen() - on custom compiled PHP with mbstring enabled

和自甴很熟 提交于 2019-12-03 13:24:13
I have this custom compiled PHP (v5.3.3) with the following extensions enabled (via configure): ./configure --prefix=/usr/local/php5.3.3 --with-config-file-path=/usr/local/apache2/conf --with-apxs2=/usr/local/apache2/bin/apxs --with-bz2 --with-curl=/usr/lib --with-curlwrappers --with-freetype-dir=/usr/local --with-gd=/usr/local --with-gettext --with-gmp --with-iconv=/usr/local --with-imap=/usr/local/imap2007e --with-imap-ssl --with-jpeg-dir=/usr/local/lib --with-kerberos --with-libxml-dir=/usr/lib --with-mcrypt=/usr/local --with-mhash --with-mysql=/usr/lib/mysql --with-mysql-sock=/var/lib

Dependency issue trying to install php-mbstring on ec2

假装没事ソ 提交于 2019-12-03 10:32:29
问题 I am trying to install yii2 on my Amazon Linux AMI instance, it requires the php-mbstring extension to work. When I tried to run sudo yum install php-mbstring it returned this error: Error: php56-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64 Loaded plugins: priorities, update-motd, upgrade-helper amzn-main/latest | 2.1 kB 00:00 amzn-updates/latest | 2.3 kB 00:00 2494 packages excluded due to repository priority protections Resolving Dependencies --> Running transaction check --->

centOS 7 Can't install php-mbstring extension

限于喜欢 提交于 2019-12-03 07:45:47
问题 i've tried to install the extension mbstring but i have the following error: Error: Package: php-mbstring-5.4.16-23.el7_0.3.x86_64 (updates) Requires: php-common(x86-64) = 5.4.16-23.el7_0.3 Installed: php-common-5.4.38-1.el7.remi.x86_64 (@remi) php-common(x86-64) = 5.4.38-1.el7.remi Available: php-common-5.4.16-21.el7.x86_64 (base) php-common(x86-64) = 5.4.16-21.el7 Available: php-common-5.4.16-23.el7_0.x86_64 (updates) php-common(x86-64) = 5.4.16-23.el7_0 Available: php-common-5.4.16-23.el7

Dependency issue trying to install php-mbstring on ec2

ぐ巨炮叔叔 提交于 2019-12-03 01:04:00
I am trying to install yii2 on my Amazon Linux AMI instance, it requires the php-mbstring extension to work. When I tried to run sudo yum install php-mbstring it returned this error: Error: php56-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64 Loaded plugins: priorities, update-motd, upgrade-helper amzn-main/latest | 2.1 kB 00:00 amzn-updates/latest | 2.3 kB 00:00 2494 packages excluded due to repository priority protections Resolving Dependencies --> Running transaction check ---> Package php-mbstring.x86_64 0:5.3.29-1.8.amzn1 will be installed --> Processing Dependency: php-common