Skip to content

Commit

Permalink
return of the Kint::$charEncodings setting which was evidentially sti…
Browse files Browse the repository at this point in the history
…ll used bu Russian speakers (#153, thanks, userlond)
  • Loading branch information
raveren committed Jul 2, 2015
1 parent 2739ca6 commit 0cb1329
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
16 changes: 16 additions & 0 deletions config.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@
/** @var int max length of string before it is truncated and displayed separately in full. Zero or false to disable */
$_kintSettings['maxStrLength'] = 80;

/** @var array possible alternative char encodings in order of probability, eg. array('windows-1251') */
$_kintSettings['charEncodings'] = array(
'UTF-8',
'Windows-1252', # Western; includes iso-8859-1, replace this with windows-1251 if you have Russian code
'euc-jp', # Japanese

# all other charsets cannot be differentiated by PHP and/or are not supported by mb_* functions,
# I need a better means of detecting the codeset, no idea how though :(

// 'iso-8859-13', # Baltic
// 'windows-1251', # Cyrillic
// 'windows-1250', # Central European
// 'shift_jis', # Japanese
// 'iso-2022-jp', # Japanese
);


/** @var int max array/object levels to go deep, if zero no limits are applied */
$_kintSettings['maxLevels'] = 7;
Expand Down
17 changes: 1 addition & 16 deletions parsers/parser.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,21 +636,6 @@ class kintVariableData
* HELPERS
*/

private static $_supportedCharsets = array(
'UTF-8',
'Windows-1252', # Western; includes iso-8859-1
'euc-jp', # Japanese

# all other charsets cannot be differentiated by PHP and/or are not supported by mb_* functions,
# I need a better means of detecting the codeset, no idea how though :(

// 'iso-8859-13', # Baltic
// 'windows-1251', # Cyrillic
// 'windows-1250', # Central European
// 'shift_jis', # Japanese
// 'iso-2022-jp', # Japanese
);

protected static function _detectEncoding( $value )
{
$ret = null;
Expand All @@ -665,7 +650,7 @@ protected static function _detectEncoding( $value )
}

$md5 = md5( $value );
foreach ( self::$_supportedCharsets as $encoding ) {
foreach ( Kint::$charEncodings as $encoding ) {
# fuck knows why, //IGNORE and //TRANSLIT still throw notice
if ( md5( @iconv( $encoding, $encoding, $value ) ) === $md5 ) {
return $encoding;
Expand Down

0 comments on commit 0cb1329

Please sign in to comment.