Appears to be an encoding issue...perhaps your Windows command line does not accept unicode characters? Can you check which encoding does the software use, and try changing it to utf-8 if it is different?
Mar 19, 2020
1
Level 2
Wrong output to the command prompts on windows
Trying to create a command to make a superadmin using ask prompt inputs.
When i run the command and answer a question with a any accented character, the output is wrong. Accented character are encoded. I did run the same code on both Windows and MacOs, the problem only appear when testing Windows OS.
Specs :
Laravel Version: 7.2.0
PHP Version: 7.3.12
Database Driver & Version: Mysql (10.4.10-MariaDB)
OS: Windows
Steps To Reproduce:
run php artisan make:command SuperAdmin
namespace App\Console\Commands;
use Illuminate\Console\Command;
class CreateSuperAdmin extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'make:superadmin';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new Super Admin';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$first_name = $this->ask('First name ?');
dd($first_name);
}
}
Run the make:superadmin command then answer the First name question with Rémi
Expected return: Rémi
Actual return: R\x00mi
Am i missing anything ?
Thanks for the reading.
Please or to participate in this conversation.