Forums | Mahara Community

Support /
The accent first charcter disappear


Zoltan Csernai's profile picture
Posts: 9

13 December 2016, 22:04

Hi,

I install the Mahara 16.10.0 version in the Eszterhazy Karoly College’s server (Hungary).

The install was successfull and I testing the system.

I have one notice:

In the Files area when I upload a file such as „Óravázlat.docx”, „Összefoglalás.xlsx” the system disappear the first character if begin accent. The file name another accent characters remain, just the first character disappear. In the Files area this example files display „ravázlat.docx” and „sszefoglalás.xlsx” name.

How can I show the complete file name? This is a server settings?

I testing this function my XAMPP localhost and the system show the complete file name when I upload a file which first character include accent.

Thanks,

Zoltan

Laszló Bambuk's profile picture
Posts: 22

14 December 2016, 0:27

Szia,

én első körben az adatbázist nézném meg, biztos hogy utf8?

Üdv

Laci

Zoltan Csernai's profile picture
Posts: 9

14 December 2016, 1:32

Szia,

Az adatbázis utf8. Esetleg más ötlet?

Üdv. Zoli

Laszló Bambuk's profile picture
Posts: 22

14 December 2016, 3:40

Bocs,

most látom hogy nem is ez a hiba, hanem csak az első karakter. Kicsivel is ezt csinálja?

Zoltan Csernai's profile picture
Posts: 9

14 December 2016, 5:24

Igen, kipróbáltam és a kicsivel is sajnos ezt csinálja. :(

Laszló Bambuk's profile picture
Posts: 22

14 December 2016, 7:17

Szinte biztos hogy nyelvi és a helyi beállításoknál van valami.

Ha a rendszert lehet migrálni, készítenék egy új helyet, ahol másik adatbázis típust használnák és másik php verziót és ott is kipróbálnám. A az összes mappa és a maharadata is egyforma nyelvi környezetben legyen. Vagy csak egy üres új próba telepítést is kipróbálhatsz.

 

Üdv

Laci

Ghada El-Zoghbi's profile picture
Posts: 122

14 December 2016, 19:09

Hi Zoltan,

Have you tried to upload the file on this Mahara - in your home/content/files area?

https://mahara.org/artefact/file/index.php

Does it do the same thing here?

Thanks,

Ghada

 

 

Zoltan Csernai's profile picture
Posts: 9

14 December 2016, 20:12

Hi Ghada,

Now I try on this Mahara upload a file such as „Összefoglalás.doc”, and everything is ok, the system show the accent first character. How can I show the complete file name in the Eszterhazy Karoly College’s Mahara site? Any idea?

Thanks,
Zoltan

Ghada El-Zoghbi's profile picture
Posts: 122

14 December 2016, 23:40

Hi Zoltan,

Well, at least that eliminates any error in core Mahara.

Are there any errors in the apache error log?

Do you have any customisations in your Mahara?

Can you confirm the encoding of your database and table columns in particular the artefact table is UTF8?

There's an old post about mix ups with encoding:

https://mahara.org/interaction/forum/topic.php?id=1413

Thanks, 

Ghada 

Zoltan Csernai's profile picture
Posts: 9

15 December 2016, 21:50

Hi,

Thank you Laszló and Ghada a lot of help. ;)

Ghada, there are no errors in the Apache log. No, I haven't got any customisations in the Mahara. The database is UTF8.

Yesterday my colleague see the Mahara 16.10.0 code and making some changes and it's work successfull the file upload when the first character include accent.! :D

The patch file about the changes:

diff -ru public_html.save/api/mobile/upload.php public_html/api/mobile/upload.php
--- public_html.save/api/mobile/upload.php      2016-12-14 09:51:22.508631480 +0100
+++ public_html/api/mobile/upload.php   2016-12-14 09:47:08.916634927 +0100
@@ -94,7 +94,7 @@
 if ($_FILES) {
     $file_title = $title;
     if ($blog || !$title) {  // set the filename to be the title of the artefact
-        $file_title = basename($_FILES['userfile']['name']);
+        $file_title = mb_basename($_FILES['userfile']['name']);
     }

diff -ru public_html.save/init.php public_html/init.php
--- public_html.save/init.php   2016-12-14 09:28:48.908649874 +0100
+++ public_html/init.php        2016-12-14 09:46:50.084635182 +0100
@@ -15,6 +15,9 @@
     die();
 }

+/* Redax: multi-byte safe basename() */
+function mb_basename($file) { return end(explode('/',$file)); }
+
 $CFG = new StdClass;
 $CFG->docroot = dirname(__FILE__) . DIRECTORY_SEPARATOR;
 //array containing site options from database that are overrided by $CFG
Csak public_html -ben: init.php-orig

diff -ru public_html.save/lib/form/elements/filebrowser.php public_html/lib/form/elements/filebrowser.php --- public_html.save/lib/form/elements/filebrowser.php 2016-12-14 09:28:48.692649877 +0100 +++ public_html/lib/form/elements/filebrowser.php 2016-12-14 09:48:29.812633827 +0100 @@ -940,7 +940,7 @@ else { $originalname = $_FILES['userfile']['name']; } - $originalname = $originalname ? basename($originalname) : get_string('file', 'artefact.file'); + $originalname = $originalname ? mb_basename($originalname) : get_string('file', 'artefact.file'); $data->title = ArtefactTypeFileBase::get_new_file_title($originalname, $parentfolder, $data->owner, $group, $institution); // Overwrite image file with resized version if required

 

Thanks,

Zoltan

12 results