Adding support for UTF8 Files and Folders names [Joomla 3.x]
Posted: 24 Dec 2014, 15:07
Hello, Jan!
I have made and tested the path modifications for the Phoca Gallery to make it work with UTF8(multibyte) file|folder names.
I know that some users requested this feature long time ago!
Problem
Phoca Gallery is not allowing to create and display (in some cases) folders using your native language (expet English) plus limit some allowes special chars in file names like №.
Solution
It is not good that in the 21 sentry we need some excuses not to support utf8 file and folders names (Wikimedia does it for a long time!).
First, I love Phoca products, especially Gallery, and I have decided to make some changes and fix this limitation!
1) Setlocale before using basename! (it is requed accroding to php.net manual)
Insert setlocale(LC_ALL, 'C.UTF-8', 'C'); in all files, where you are using basename!
Like:
2) Use new Joomla 3.x api + replays getCMD with getString to get full file name!
Edit administrator/components/phoca_gallery/controllers/phocagelleryu.php
I have tested this changes with russian file|folder names and it works like a charm!
Could you please insert this update to the next PG release!?
If you interested in some details, please PM me.
I have made and tested the path modifications for the Phoca Gallery to make it work with UTF8(multibyte) file|folder names.
I know that some users requested this feature long time ago!
Problem
Phoca Gallery is not allowing to create and display (in some cases) folders using your native language (expet English) plus limit some allowes special chars in file names like №.
Solution
It is not good that in the 21 sentry we need some excuses not to support utf8 file and folders names (Wikimedia does it for a long time!).
First, I love Phoca products, especially Gallery, and I have decided to make some changes and fix this limitation!
1) Setlocale before using basename! (it is requed accroding to php.net manual)
Insert setlocale(LC_ALL, 'C.UTF-8', 'C'); in all files, where you are using basename!
Like:
Code: Select all
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
phocagalleryimport('phocagallery.image.image');
phocagalleryimport('phocagallery.path.path');
phocagalleryimport('phocagallery.file.filefolder');
setlocale(LC_ALL, 'C.UTF-8', 'C');
2) Use new Joomla 3.x api + replays getCMD with getString to get full file name!
Edit administrator/components/phoca_gallery/controllers/phocagelleryu.php
Code: Select all
$phocaGalleryApp = JFactory::getApplication();
$folderNew = $phocaGalleryApp->input->getSTRING('foldername', '');
$folderCheck = $phocaGalleryApp->input->getSTRING('foldername', null, '', 'string', JREQUEST_ALLOWRAW);
//$folderNew = JRequest::getCmd( 'foldername', '');
//$folderCheck = JRequest::getVar( 'foldername', null, '', 'string', JREQUEST_ALLOWRAW);
Could you please insert this update to the next PG release!?
If you interested in some details, please PM me.