When using the VK API method wall.get , trying to get the proposed post with smiles, I get the proposed post, but instead of smiles there are squares. I tried to change the encoding - nothing happens.

I use PHP and VK class . I tried to catch the answer immediately after cURL, but there are also squares, so the class has nothing to do with it.

Has anyone encountered a similar problem?

  • Squares are fonts that are not there, and they do not know how to display themselves. Apparently the font library must also be taken - Vasily Barbashev
  • Instead of smiles, they have unicode characters corresponding to smiles. It looks like a simple font character for the characters was not found - gil9red
  • If immediately after the wall.get method, apply the wall.post method with the text obtained from wall.get. then smiles in VK appear, but I would like to change smiles in places or add delete. It does not work. - baneling

1 answer 1

  // ΠΏΡ€Π΅ΠΎΠ±Ρ€Π°Π·ΡƒΠ΅ΠΌ юникод ΠΊΠΎΠ΄ смайла Π² символы Ρ‚ΠΈΠΏΠ° &\#11111 $tmp = $post['text']; $arr_tmp = utf8_to_unicode_code($tmp); $arr_smile = explode(';',$smile); foreach($arr_smile as $key => $val) { $key_smile = array_keys($arr_tmp,$val); if(!empty($key_smile)) { //Ссли нСсколько ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²Ρ‹Ρ… смайлов $arr = $key_smile; if (!is_array($key_smile)){ $arr = array($key_smile); } $cod_smile = utf8_to_unicode_code($arr_tmp[reset($key_smile)]); //удаляСм Π½Π°Ρ‡Π°Π»ΡŒΠ½Ρ‹ΠΉ символ юникода unset($cod_smile[0]); foreach($arr as $v){ $key_smile = array_search($val,$arr_tmp); $merg_arr = array_merge(array(38, 92, 35) , $cod_smile, array(59)); array_splice($arr_tmp, $key_smile , 1, $merg_arr); } } } function utf8_to_unicode_code($utf8_string) { $expanded = iconv("UTF-8", "UTF-32", $utf8_string); //array_merg для Ρ‚ΠΎΠ³ΠΎ Ρ‡Ρ‚ΠΎΠ± индСксация Π½Π°Ρ‡ΠΈΠ½Π°Π»Π°Ρ‡ΡŒ с 0 return array_merge(unpack("L*", $expanded),array()); } function unicode_code_to_utf8($unicode_list) { $result = ""; foreach($unicode_list as $key => $value) { $one_character = pack("L", $value); $result .= iconv("UTF-32", "UTF-8", $one_character); } return $result; } 

option is not perfect but working, all the salt in the functions