Questions tagged [mb-convert-encoding]

46 questions
1
vote
1 answer

alternative of mb_convert_encoding 'HTML-ENTITIES'

I use this code: $wpCharset = "UTF8" //or any other charset //http://php.net/manual/en/domdocument.loadhtml.php#74777 $content = mb_convert_encoding($content, 'HTML-ENTITIES', $wpCharset); $dom = new DOMDocument('1.0', $wpCharset); $success =…
Andrey
  • 63
  • 2
  • 8
1
vote
1 answer

Prestashop website error. Website showing fatal error mb_convert_encoding

I have a prestashop website http://www.mumsnbabysupermart.com.au/. The website was fully functional BUT suddenly website stop working and shows a fatal error. The error is- Fatal error : call to undefined function mb_convert_encoding() in…
1
vote
1 answer

Converting CSV file to UCS-2LE encoding with php

I'm creating a csv file. I need it to be in UCS-2LE encoding. I tried the following, neither of which work: $value = mb_convert_encoding($value,"UCS-2LE"); $value= iconv( mb_detect_encoding( $value ), 'UCS-2LE', $value ); Opening the file in…
0
votes
1 answer

why do i have to use mb_convert_encoding($name,'ISO-8859-15','utf-8') to get accented chars to display?

the data im working with here is off of a page that uses utf8 encoding i've set my database and fields to use utf8_general_ci now for whatever reason, i have to use the following code on the variable in order to have it display accented characters…
scarhand
  • 4,269
  • 23
  • 63
  • 92
0
votes
1 answer

PHP mb_convert_encoding convert from UTF-8 to SHIFT JIS is wrong

I use mb_convert_encoding function to convert UTF8 characters to SJIS characters. Before conversion:でんぱ組 出会いの歌26 カミソヤマ ユニ After conversion: て?んは?組 出会いの歌26 カミソヤマ ユニ Non-convertible characters: て?んは? Code used to convert : $str =…
Ihenry
  • 111
  • 1
  • 2
  • 12
0
votes
2 answers

How can i change the encoding of a php page?

Im trying to change the encoding of a php file (through another php page) to UTF-8 , i mean without editor . i tried to use file_get_contents and file_put_contents . i used this code but it doesn't work ! $text =…
Programmer4me
  • 99
  • 1
  • 6
0
votes
2 answers

how does mb_convert_encoding work?

I had a trouble exporting UTF-8 data to Excel, but now it's ok, because I've found this: Microsoft Excel mangles Diacritics in .csv files? Look at this line: echo chr(255) . chr(254) . mb_convert_encoding($csv, 'UTF-16LE', 'UTF-8'); When I remove…
noname
  • 551
  • 9
  • 29
0
votes
1 answer

Why "mb_convert_encoding() expects parameter 1 to be string, array given", if on php.net it accepts array?

$data = ['abcd', 'ddd']; $data = mb_convert_encoding($data, 'utf-8', 'windows-1251'); I get warning: mb_convert_encoding() expects parameter 1 to be string, array given. But according to php.net mb_convert_encoding() accepts array. See…
Igor Tarasov
  • 27
  • 2
  • 11
0
votes
0 answers

Encoding smileys in a string with mb_convert_encoding

I would like to encode smileys in PHP. For example : $string = "blah blah blah"; mb_convert_encoding($string, "HTML-ENTITIES", "UTF-8"); I'm getting : blah blah 😋 blah But I would like : blah blah 😋 blah How I can achieve that…
Manu
  • 838
  • 5
  • 7
0
votes
0 answers

How to properly convert characters in GB2312 to UTF-8 in PHP?

I have variables with chinese words, their charset is GB2312. I want to convert them to UTF-8 because I want to save them to mysql table with utf-8 encoding. How to do that is PHP? I'm using PHP 7. Here are what I have tried: I have tried using…
0
votes
1 answer

PHP mb_convert_encoding doesn't work on query

I am trying to generate a query string. Characters show up as different queries. Php version:7.3.2 Function $D->query = ''; if ($this->query('x')) { $D->query = mb_convert_encoding($this->query('x'), 'UTF-8'); } Result for…
0
votes
0 answers

mb_convert_encoding not working sometimes: Uncaught URIError: URI malformed

mb_convert_encoding() is not working for Cyrillic characters and other special characters if used with PHP and jQuery AJAX. The error is as follows: Uncaught URIError: URI malformed at decodeURIComponent () at Object. (popular:3725) …
0
votes
0 answers

How to convert from mb_convert_encoding($file, 'UTF-8', 'Windows-1251') back?

In php I use mb_convert_encoding($file, 'UTF-8', 'Windows-1251') and I need to convert this back as the output is not human readable. The current output looks like this П„ПѓО№ОЅП„ПѓО№О»О±МЃ_3.jpg When I tried mb_convert_encoding($file,…
Roman
  • 1,118
  • 3
  • 15
  • 37
0
votes
0 answers

html file_get_contents() encoding issue

I try to display html content file into php. $file_to_load = "index.html"; $html_page = file_get_contents($file_to_load); But it's output : �<�!�D�O�C�T�Y�P�E� �h�t�m�l�>���<�h�t�m�l�>�� And mb_convert_encoding($html_page , 'UTF-8' ,…
0
votes
1 answer

PHP upload filename in arabic showing special characters in folder

I am using CodeIgnitor PHP and uploading an excel file in a folder in IIS server. For the files that have English naming convention is working file and uploading ok but whenever the files names come in Arabic for example: اسم ملف العينة.xls after…