diff --git a/.gitignore b/.gitignore index a51a3c3..b9abbeb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.buildpath +.project +.settings .idea/ config.core.php data/ diff --git a/src/BaseCommand.php b/src/BaseCommand.php index d2312d0..4b6392a 100644 --- a/src/BaseCommand.php +++ b/src/BaseCommand.php @@ -83,6 +83,10 @@ public function convertBytes($bytes) public function normalizePath($path) { $normalized_path = str_replace('\\', Gitify::$directorySeparator, $path); + // especially for windows, convert utf8 to local encoding to fix umlauts in filenames + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $normalized_path = utf8_decode($normalized_path); + } return $normalized_path; } diff --git a/src/Command/BuildCommand.php b/src/Command/BuildCommand.php index 8543260..c73462c 100644 --- a/src/Command/BuildCommand.php +++ b/src/Command/BuildCommand.php @@ -241,8 +241,11 @@ public function buildResources($context, $iterator) $file = file_get_contents($resource->getRealPath()); // Normalize line-endings to \n to ensure consistency + /* this causes file modifications when comparing with afterwards extraction $file = str_replace("\r\n", "\n", $file); $file = str_replace("\r", "\n", $file); + */ + // Check if delimiter exists, otherwise add it to avoid WARN in explode() // (WARN @ Gitify/src/Command/BuildCommand.php : 246) PHP notice: Undefined offset: 1 if (strpos($file, Gitify::$contentSeparator) === false) {