Category : utf-8

The input is ISO-8859-1 and is imported via a CSV file $input = ‘Làfontaine’; $utf8 = utf8_encode($input); $utf8 = preg_replace(‘/[^[:print:]n]/u’, ”, mb_convert_encoding($input, ‘UTF-8’, ‘UTF-8’)); echo "$utf8"; Before inserting text into database I use this line to strip all invalid UTF8 chars. It seems to work in almost every case, but in this specific case the ..

Read more

this is the first time that I make a database and I want to choose ( utf8_general_ci ) for server connection collation But when I select it, this message appears Insert command rejected for user ‘pma’ @ ‘localhost’ for table ‘pma__userconfig’… what is the solution? Sourc..

Read more

I’m trying to parse csv data to arrays with str_getcsv in PHP but the separation of the data will be changed in the arrays. my locale setting setlocale(LC_ALL, ‘ja_JP.UTF-8′); my original csv data "タナカ","タロウ" data given by str_getcsv "タナカ",タロウ"" and it’s also combine as a value. It seems like katakana is causing the problem but ..

Read more

in the CSV file itself, special characters are appearing. but when the file is imported to the database, the special characters (äÄ, öÖ, üÜ, ß) aren’t stored correctly. I’m using this code to import the file: $handle = fopen (‘../csv/file.csv’, ‘r’ ); while ($data = fgetcsv ($handle, 1024, ‘;’)) { $data = array_map(‘utf8_encode’, $data); $num ..

Read more

I’m querying the Facebook API in PHP to get a list of posts and display it on a website. // $facebook is an instance of FacebookFacebook $response = $facebook->get(‘posts?fields=id,message,created_time,full_picture,permalink_url,status_type&limit=20’); $graphEdge = $response->getGraphEdge(); $posts = []; foreach ($graphEdge as $post) { $message = $post->getField(‘message’); } The text returned by the call looks like the picture below: ..

Read more

I have many arrays that share the same keys but in different values, and different order: $array = array( ‘English’ => array( ‘1’ => ‘Apples’, ‘2’ => ‘Oranges’, ‘3’ => ‘Bananas’ ), ‘Spanish’ => array( ‘3’ => ‘Plátanos’, ‘1’ => ‘Manzanas’, ‘2’ => ‘Naranjas’ ), ‘German’ => array( ‘1’ => ‘Äpfel’, ‘3’ => ‘Bananen’, ‘2’ ..

Read more