From 313c3d43395bdf3883e4c6ca8cfabd6d3129290a Mon Sep 17 00:00:00 2001 From: Tristan Lins Date: Mon, 25 Aug 2014 07:17:15 +0200 Subject: [PATCH 1/2] Fix #2, add default value to delimiter and enclosure option. --- src/Command/GenerateCommand.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Command/GenerateCommand.php b/src/Command/GenerateCommand.php index 8aca72f..0666aa1 100644 --- a/src/Command/GenerateCommand.php +++ b/src/Command/GenerateCommand.php @@ -38,13 +38,15 @@ protected function configure() 'delimiter', 'd', InputOption::VALUE_REQUIRED, - 'The delimiter is used by the csv and printf format.' + 'The delimiter is used by the csv and printf format.', + ',' ) ->addOption( 'enclosure', 'e', InputOption::VALUE_REQUIRED, - 'The enclosure is used by the csv and printf format.' + 'The enclosure is used by the csv and printf format.', + '"' ) ->addOption( 'escape', @@ -266,7 +268,7 @@ protected function outputPhp(OutputInterface $output, $data) protected function outputPrintf(InputInterface $input, OutputInterface $output, $data) { $pattern = $input->getOption('pattern'); - $delimiter = $input->getOption('delimiter') ? : ','; + $delimiter = $input->getOption('delimiter'); $enclosure = $input->getOption('enclosure'); $escape = $input->getOption('escape'); From 05e120fa728daf7cba9c50c93797c2704b2befa2 Mon Sep 17 00:00:00 2001 From: Tristan Lins Date: Mon, 25 Aug 2014 07:23:19 +0200 Subject: [PATCH 2/2] Fix #3, do not escape UTF-8 multibyte characters in JSON format. --- composer.json | 2 +- src/Command/GenerateCommand.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 72d9e10..b7b3f7a 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ } ], "require": { - "php": ">=5.3.3", + "php": ">=5.4", "fzaninotto/faker": "~1.0", "symfony/console": "~2.3" }, diff --git a/src/Command/GenerateCommand.php b/src/Command/GenerateCommand.php index 0666aa1..16613d8 100644 --- a/src/Command/GenerateCommand.php +++ b/src/Command/GenerateCommand.php @@ -140,7 +140,7 @@ protected function execute(InputInterface $input, OutputInterface $output) */ protected function outputJson(OutputInterface $output, $data) { - $json = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); + $json = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); $output->write($json); }