https://bugzilla.wikimedia.org/show_bug.cgi?id=1780

orbartal <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #32 from orbartal <[email protected]> ---
How to fix the bug in Hebrew  (and in  any other language that windows support)

1.    In windows OS change the language for non-Unicode to your local MediaWiki
language. E.g. the language of the files names you wish to upload. Usually it
is the same as $wgLanguageCode language.  See how on this link. 
2.    Windows NTFS file system uses special encoding, not ascii or utf8. Check
the appropriate encoding for your language. For Hebrew I used windows-1255.
3.    Edit the MediaWiki core code, and add these 4 changes. Note to use your
language and not windows-1255. I used windows-1255 for Hebrew, but you might
need something else. 
a.    Remove (or put as a comment) the test added by Bryan Tong Minh that
prevent from uploading files with non ascii name in windows. Later we shell fix
the bug, so that filter is no longer required. 
See details: https://www.mediawiki.org/wiki/Special:Code/MediaWiki/88165 
MediaWiki/includes/upload/UploadBase.php line 756. 
b.    Go to the source code file in 
MediaWiki/includes/filebackend/ FSFileBackend.php. And in class
FileBackendStore, in function FileBackendStore :: doStoreInternal in line 206,
add the following lines:

if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') 
{
$charSetArr = array("ASCII", "JIS", "EUC-JP", "UTF-8", "UTF-16","windows-1251", 
"ISO-8859-1", "GBK");
        if (mb_detect_encoding($dest, $charSetArr) =="UTF-8")
        {
                $dest = iconv("UTF-8", "windows-1255",  $dest);
        }    
    }
Just before the command that copies the file to the path:
$ok = copy( $params['src'], $dest );

Now you can upload files and images in Hebrew. But you can’t view them as
thumbnail. Two more similar code fix are required for this task to complete. 

c.    Go to the source code file in MediaWiki\includes\filerepo\file\File.php.
And in class File, in function File:: transform in line 623, add the following
lines:
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') 
{
$charSetArr = array("ASCII", "JIS", "EUC-JP", "UTF-8", "UTF-16","windows-1251",
 "ISO-8859-1", "GBK");
if (mb_detect_encoding($thumbPath, $charSetArr) =="UTF-8")
{
        $thumbPath = iconv("UTF-8", "windows-1255",  $thumbPath);
}    
}
Right after the command returns the full path to the folder of the thumbnail
file: 
$thumbPath = $this->getThumbPath( $thumbName ); // final thumb path
d.    Go to the source code file in  MediaWiki\includes\media\Bitmap.php. And
in class BitmapHandler, in function BitmapHandler::transformGd in line 548, add
the following lines:
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') 
{
$charSetArr = array("ASCII", "JIS", "EUC-JP", "UTF-8", "UTF-16","windows-1251", 
"ISO-8859-1", "GBK");
if (mb_detect_encoding($params['srcPath'], $charSetArr) =="UTF-8")
{
            $params['srcPath'] = iconv("UTF-8", "windows-1255", 
$params['srcPath']);
}    
}
Right before the command that test if the file exists in that location: 
 if ( !file_exists( $params['srcPath'] ) )

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to