Skip to content

Commit

Permalink
Default encoding changed from iso-8859-1 to utf-8 (request squizlabs#760
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gsherwood committed Jul 1, 2016
1 parent a1dc21b commit d3fe9ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Caching between runs (--cache, --no-cache and "cache" config var) (request #530)
-- Use --cache=/path/to/cacheFile to use a specific file
- Check files in parallel (--parallel=1 for off, --parallel=100 etc) (request #421)
- Default encoding changed from iso-8859-1 to utf-8 (request #760)
-- encoding config option still works, but no longer have to set it to get utf-8 strings
-- if you are already setting encoding to utf-8 in a ruleset or on CLI, you can remove it
-- still need to have the iconv extension installed for utf-8 strings to be processed correctly
- Added a new "code" report type to show a code snippet for each error (request #419)
-- The line containing the error is printed, with 2 lines above and below
-- The location of the errors is underlined in the code
Expand Down
4 changes: 2 additions & 2 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ public function printPHPCSUsage()
echo ' <cacheFile> Use a specific file for caching (uses a temporary file by default)'.PHP_EOL;
echo ' <basepath> A path to strip from the front of file paths inside reports'.PHP_EOL;
echo ' <file> One or more files and/or directories to check'.PHP_EOL;
echo ' <encoding> The encoding of the files being checked (default is iso-8859-1)'.PHP_EOL;
echo ' <encoding> The encoding of the files being checked (default is utf-8)'.PHP_EOL;
echo ' <extensions> A comma separated list of file extensions to check'.PHP_EOL;
echo ' (extension filtering only valid when checking a directory)'.PHP_EOL;
echo ' The type of the file can be specified using: ext/type'.PHP_EOL;
Expand Down Expand Up @@ -1139,7 +1139,7 @@ public function printPHPCBFUsage()
echo ' --version Print version information'.PHP_EOL;
echo ' <basepath> A path to strip from the front of file paths inside reports'.PHP_EOL;
echo ' <file> One or more files and/or directories to fix'.PHP_EOL;
echo ' <encoding> The encoding of the files being fixed (default is iso-8859-1)'.PHP_EOL;
echo ' <encoding> The encoding of the files being fixed (default is utf-8)'.PHP_EOL;
echo ' <extensions> A comma separated list of file extensions to fix'.PHP_EOL;
echo ' (extension filtering only valid when checking a directory)'.PHP_EOL;
echo ' The type of the file can be specified using: ext/type'.PHP_EOL;
Expand Down
4 changes: 2 additions & 2 deletions src/Tokenizers/Tokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private function createPositionMap()
$inTests = defined('PHP_CODESNIFFER_IN_TESTS');

$checkEncoding = false;
if ($this->config->encoding !== 'iso-8859-1' && function_exists('iconv_strlen') === true) {
if (function_exists('iconv_strlen') === true) {
$checkEncoding = true;
}

Expand Down Expand Up @@ -266,7 +266,7 @@ private function createPositionMap()
public function replaceTabsInToken(&$token, $prefix=' ', $padding=' ')
{
$checkEncoding = false;
if ($this->config->encoding !== 'iso-8859-1' && function_exists('iconv_strlen') === true) {
if (function_exists('iconv_strlen') === true) {
$checkEncoding = true;
}

Expand Down

0 comments on commit d3fe9ac

Please sign in to comment.