Skip to content

Commit

Permalink
Fixed issue #7051: Images uploaded in HTML editor end up in wrong dir…
Browse files Browse the repository at this point in the history
…ectory on Windows
  • Loading branch information
c-schmitz committed Dec 9, 2012
1 parent c676762 commit 348e8de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions third_party/kcfinder/core/browser.php
Expand Up @@ -724,6 +724,7 @@ protected function getFiles($dir) {
if ($stat === false) continue;
$filename = basename($file);
if ( 'WIN' == substr( PHP_OS, 0, 3 ) ) {
setlocale( LC_CTYPE, '' ); // Resets the codepage to the system codepage so it can be properly retrieved
$codepage = 'Windows-' . trim( strstr( setlocale( LC_CTYPE, 0 ), '.' ), '.' );
if ( function_exists( 'iconv' ) ) {
$filename = iconv( $codepage, 'UTF-8', $filename );
Expand Down
3 changes: 2 additions & 1 deletion third_party/kcfinder/core/uploader.php
Expand Up @@ -342,7 +342,8 @@ protected function normalizeFilename($filename) {
)
$filename = strtr($filename, $this->config['filenameChangeChars']);
// On Windows platforms, PHP will mangle non-ASCII characters, see http://bugs.php.net/bug.php?id=47096
if ( 'WIN' == substr( PHP_OS, 0, 3 ) ) {
if ( 'WIN' == substr( PHP_OS, 0, 3 )) {
setlocale( LC_CTYPE, '' ); // Resets the codepage to the system codepage so it can be properly retrieved
$codepage = 'Windows-' . trim( strstr( setlocale( LC_CTYPE, 0 ), '.' ), '.' );
if ( function_exists( 'iconv' ) ) {
$filename = iconv( 'UTF-8', $codepage, $filename );
Expand Down

0 comments on commit 348e8de

Please sign in to comment.