Skip to content

Instantly share code, notes, and snippets.

@billyct
Last active March 9, 2018 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billyct/e4fb3aa3a9045fdbe93f64986b3477a4 to your computer and use it in GitHub Desktop.
Save billyct/e4fb3aa3a9045fdbe93f64986b3477a4 to your computer and use it in GitHub Desktop.
unescape unicode files under path
<?php
function unescapedFiles($path){
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file) {
$file = str_finish($path, '/') . $file;
$content = json_decode(file_get_contents($file), true);
$content = json_encode($content, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
file_put_contents($file, $content);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment