Questions tagged [mbstring]

MultiByte String in PHP

Related topics:

195 questions
6
votes
1 answer

Replacing invalid UTF-8 characters by question marks, mbstring.substitute_character seems ignored

I would like to replace invalid UTF-8 chars with quotation marks (PHP 5.3.5). So far I have this solution, but invalid characters are removed, instead of being replaced by '?'. function replace_invalid_utf8($str) { return mb_convert_encoding($str,…
Maxime Pacary
  • 22,336
  • 11
  • 85
  • 113
6
votes
5 answers

Composer Install - requires ext-mbstring

I am trying to do a composer install ..., but getting an error of requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system. I am using Apache (Cpanel) and PHP 5.6. Below are the ways I am trying to fix the…
Pak Ho Cheung
  • 1,382
  • 6
  • 22
  • 52
6
votes
5 answers

Ubuntu 16.04 The mbstring extension is missing

I want to migrate my web server from unsupported version of ubuntu 12.10. I installed 16.04 and installed apache2, php7, mysql and phpmyadmin. When I want to use phpmyadmin I have error that mbstring missing. In PHP.ini file, there is only to enable…
DusanP
  • 63
  • 1
  • 1
  • 5
6
votes
1 answer

json_encode returns false when dealing with multibyte substring

I am using almost the latest version of php (5.5.11) and here is the problem. When I use json_encode of the part of the string, it returns false. In the beginning I was using substr, but then I realized that this is totally wrong when dealing with…
Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
6
votes
4 answers

PHP convert unicode spaces to ascii spaces

So I'm having a problem where I believe what's happening is I'm receiving data that uses some unicode spaces and some ascii spaces, such that certain strings that appear the same are not equivalent, for example, "water resistant" != "water…
Kai
  • 3,803
  • 1
  • 16
  • 33
6
votes
1 answer

What does mbstring.strict_detection do?

The mbstring PHP module has a strict_detection setting, documented here. Unfortunately, the manual is completely useless; it only says that this option "enables the strict encoding detection". I did a few tests and could not find how any of the…
Zilk
  • 8,917
  • 7
  • 36
  • 44
6
votes
4 answers

PHP: mb_strtoupper not working

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')…
Alasdair
  • 13,348
  • 18
  • 82
  • 138
6
votes
3 answers

Call to undefined function FOS\UserBundle\Util\mb_convert_case()

I'm getting error Call to undefined function FOS\UserBundle\Util\mb_convert_case() app_path/vendor/bundles/FOS/UserBundle/Util/Canonicalizer.php on line 18 It occurs when I try to load fixtures. First step was to install mbstring.so ext, so I…
zachar
  • 1,085
  • 1
  • 11
  • 18
5
votes
3 answers

Can't get mbstring to work on Amazon linux 2 AMI

I run on Amazon linux 2 AMI, With PHP 7.2.5 and apache The probleme is: Call to undefined function mb_convert_encoding The initial need is to be able to read an uploaded text file correctly and have its content inserted in DB, knowing that the…
Jay Cohen
  • 193
  • 2
  • 9
5
votes
2 answers

Adding mbstring to docker image for laravel 5 app

I am new to docker and I'm trying to set it up in order to run with Laravel 5.1. I am currently getting the following error Call to undefined function Illuminate\Foundation\Bootstrap\mb_internal_encoding() in…
SamBremner
  • 793
  • 2
  • 10
  • 22
5
votes
1 answer

How to determine the minimum number of bytes required by a character?

Is there a way to determine for sure the minimum number of bytes required by a character in a specific encoding? Like one of the encodings supported by the mbstring extension. The value will be 1 for UTF-8, 2 for UTF-16, etc. I don't want to obtain…
Ayell
  • 560
  • 2
  • 12
5
votes
2 answers

mb_convert_encoding() not working with phpunit

For some reason, when running mb_convert_encoding in phpunit, I am getting unexpected results. For example doing the following: var_dump( mb_convert_encoding( utf8_decode( 'ö' ), 'UTF-8' ) === 'ö' ) The above returns bool (true) under PHP-FPM, and…
Joe Hoyle
  • 228
  • 1
  • 9
4
votes
4 answers

Php cannot find way to split utf-8 strings

i just started dabbling in php and i'm afraid i need some help to figure out how to manipulate utf-8 strings. I'm working in ubuntu 11.10 x86, php version 5.3.6-13ubuntu3.2. I have a utf-8 encoded file (vim :set encoding confirms this) which i then…
bottlenecked
  • 2,079
  • 2
  • 21
  • 32
4
votes
1 answer

what is filtering invalid utf8 from my PHP website?

My website is fully converted to use utf-8, (mysql, http headers, PHP mb_string etc). Im doing some penetration testing and trying to POST invalid utf to one of the scripts (using BurpSuite). But when I post the invalid utf, an just hex-dump the…
carpii
  • 1,917
  • 4
  • 20
  • 24
4
votes
1 answer

Is php trim mb safe

I know that there is no mb_trim version of the trim. I have links to the dozen of articles for how to implement one using preg_replace. The question I have, is the usual trim with default chars mb safe? That is, is there any example of multibyte…
loshad vtapkah
  • 429
  • 4
  • 11
1 2
3
12 13