Questions tagged [mbstring]

MultiByte String in PHP

Related topics:

180 questions
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
  • 182,715
  • 129
  • 638
  • 708
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,623
  • 1
  • 13
  • 31
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
  • 7,316
  • 7
  • 32
  • 38
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
  • 11,936
  • 14
  • 66
  • 125
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,055
  • 1
  • 11
  • 18
5
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,…
Frosty Z
  • 20,022
  • 9
  • 74
  • 102
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
  • 540
  • 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
  • 1,829
  • 2
  • 20
  • 29
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,748
  • 3
  • 16
  • 24
4
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,402
  • 6
  • 19
  • 41
4
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
  • 643
  • 1
  • 7
  • 18
4
votes
1 answer

php mb_convert_case() keep words that are in uppercase

Assuming I have a string "HET1200 text string" and I need it to change to "HET1200 Text String". Encoding would be UTF-8. How can I do that? Currently, I use mb_convert_case($string, MB_CASE_TITLE, "UTF-8"); but that changes "HET1200" to "Het1200. I…
Lyon
  • 7,144
  • 10
  • 29
  • 45
4
votes
3 answers

PHP/MySQL Encoding

I have a website, with arabic content which has been migrated from a different server. On the old server, everything was displaying correctly, supposedly everything was encoded with UTF-8. On the current server, the data started displaying…
Adon
  • 345
  • 1
  • 12
4
votes
2 answers

Table already utf8 charset, still getting question marks in some characters

I'm trying to change my encoding to utf-8, below is what I have so far. Table Charset mbstring installed extension=php_mbstring.dll mbstring configured in php.ini mbstring.language = Neutral mbstring.internal_encoding =…
vephelp
  • 542
  • 1
  • 8
  • 24
1 2
3
11 12