Skip to content

Instantly share code, notes, and snippets.

@Krknv
Created January 26, 2018 10:21
Show Gist options
  • Save Krknv/d95413dc5061584972004ff9b4a7cfec to your computer and use it in GitHub Desktop.
Save Krknv/d95413dc5061584972004ff9b4a7cfec to your computer and use it in GitHub Desktop.

How to json_encode array with cyrilic accents?

// преобразование utf8 в cp1251
$current_charset = 'windows-1251';
array_walk_recursive($m_post, function(&$value) use ($current_charset) {
  $value = iconv($current_charset, 'UTF-8', $value);
});

$str_post = array('str_post' => json_encode($m_post));

https://stackoverflow.com/a/6929069/2618535

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment