Mark ext-iconv as required dependency

This commit is contained in:
itismadness
2024-02-12 23:58:41 +00:00
parent 9940416651
commit f02d02155a
3 changed files with 11 additions and 4 deletions

View File

@@ -17,10 +17,11 @@
},
"require": {
"php": "^8.1",
"ext-iconv": "*",
"ext-mbstring": "*",
"symfony/console": "^6.0|^7.0",
"symfony/yaml": "^6.0|^7.0",
"symfony/process": "^6.0|^7.0"
"symfony/process": "^6.0|^7.0",
"symfony/yaml": "^6.0|^7.0"
},
"bin": ["bin/logchecker"],
"require-dev": {
@@ -45,6 +46,7 @@
"config": {
"platform": {
"php": "8.1"
}
},
"sort-packages": true
}
}

3
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e4d60c26c156775fe28702c92cf76037",
"content-hash": "7f154ad99b1d7d4d57ba32adf8ecaaa9",
"packages": [
{
"name": "psr/container",
@@ -2618,6 +2618,7 @@
"prefer-lowest": false,
"platform": {
"php": "^8.1",
"ext-iconv": "*",
"ext-mbstring": "*"
},
"platform-dev": [],

View File

@@ -39,6 +39,10 @@ class Util
} elseif ($chardet !== null) {
$results = $chardet->analyze($logPath);
if ($results['charset'] !== 'utf-8' && $results['confidence'] > 0.7) {
// ideally we'd be able to use mb_convert_encoding as it has more widespread
// support vs iconv, but it does not support as many encodings as iconv, such
// as Windows-1250 (along with others) which is a common encoding for range logs
// coming from rutracker
// $log = mb_convert_encoding($log, 'UTF-8', $results['charset']);
$tmp = @iconv($results['charset'], 'UTF-8', $log);