I'm using Laravel 5 and i'm making an AJAX request
with which the user can create a directory
. But if the user uses a Cyrillic alphabet
the newly created dir appears to be strange: РЎРЅРёРјРєРё
. This is the ajax:
$.ajax({
async: true,
method: 'POST',
dataType: 'json',
url: '../public/createfolder',
data: {foldername: $('#folder-name').val(), "_token": csrf},
complete: function(response) {
console.log(response);
}
});
And that's how I catch the request:
public function createFolder(){
$foldername = $_POST['foldername'];
$ds = DIRECTORY_SEPARATOR;
$userid = Auth::id();
Storage::disk('local')-> makeDirectory('uploads'.$ds.$userid.$ds.$foldername);
}
How can this be avoided?