Page 1 of 1
National characters in the filename of the attachment
Posted: Wed Apr 15, 2015 2:37 pm
by Bat1
Script URL: support.maash.ru
Version of script: 2.6.2
The message does not attach files that have a file name national symbols, in my case, Russian characters. In previous versions (2.5.x) this problem has not been.
Please make an update that will fix the problem. This is a very impedes the work.
Re: National characters in the filename of the attachment
Posted: Wed Apr 15, 2015 5:14 pm
by Klemen
Try uploading this modified "posting_functions.inc.php" file inside your "inc" folder:
http://www.hesk.com/extras/26x_filename.zip
Does it work then (file names will be changed anyway to avoid some possible DB-related errors)?
Re: National characters in the filename of the attachment
Posted: Thu Apr 16, 2015 8:35 am
by Bat1
Thank files now properly attached to the message.
But if you can do transcoding Russian national symbols in transliteration, and other symbols of nationally in their similar counterparts in Latin?
For example:
$filename = strtr($filename, array('а'=>'a','б'=>'b','в'=>'v','г'=>'g','д'=>'d','е'=>'e','ё'=>'e','ж'=>'j','з'=>'z','и'=>'i','й'=>'y','к'=>'k','л'=>'l',
'м'=>'m','н'=>'n','о'=>'o','п'=>'p','р'=>'r','с'=>'s','т'=>'t','у'=>'u','ф'=>'f','х'=>'h','ц'=>'c','ч'=>'ch','ш'=>'sh',
'щ'=>'shch','ы'=>'y','э'=>'e','ю'=>'yu','я'=>'ya','ъ'=>'','ь'=>'', 'А'=>'A','Б'=>'B','В'=>'V','Г'=>'G','Д'=>'D','Е'=>'E','Ё'=>'E','Ж'=>'J','З'=>'Z','И'=>'I','Й'=>'Y','К'=>'K','Л'=>'L',
'М'=>'M','Н'=>'N','О'=>'O','П'=>'P','Р'=>'R','С'=>'S','Т'=>'T','У'=>'U','Ф'=>'F','Х'=>'H','Ц'=>'C','Ч'=>'CH','Ш'=>'SH',
'Щ'=>'SHCH','Ы'=>'Y','Э'=>'E','Ю'=>'YU','Я'=>'YA','Ъ'=>'','Ь'=>''));
Re: National characters in the filename of the attachment
Posted: Thu Apr 16, 2015 10:53 am
by Klemen
I don't promise but will look into it

Re: National characters in the filename of the attachment
Posted: Thu Apr 16, 2015 11:22 am
by Bat1
I have tried to add a new characters into the array $chars in function remove_accents and everything worked the as I wanted. But there was another problem. The new version functions hesk_cleanFileName remove the first word in the file name, for example "protokol examenov 21.ods" is converting "examenov-21.ods". I do not know why, but the problem happens only if file name contains Russian characters. If the file name have only Latin characters, the function works correctly.
Now i am in the original file posting_functions.inc.php fixed function remove_accents. Now everything works as I wanted.
Re: National characters in the filename of the attachment
Posted: Thu Apr 16, 2015 4:52 pm
by Klemen
Well the idea is to make the file name safe for any language/invalid encodings/mixed encodings etc. I think it's better to accept the file and give it a completely different name than to encounter encoding-related errors in MySQL for example (which happened and this was the exact reason I added removal of anything non-ascii).
Re: National characters in the filename of the attachment
Posted: Sun May 03, 2015 2:59 pm
by Klemen
Could you try this modification please:
http://www.hesk.com/extras/transliteration.zip
1. upload to your "inc" folder
2. test
Does this work normally with your files?
Re: National characters in the filename of the attachment
Posted: Tue May 05, 2015 8:22 am
by Bat1
Hi!
That's better. The characters are converted, but ...
1) remove the first word in the filename
2) if the name contains national characters and English characters and numbers, all national symbols removed
I am sending the modified file that works exactly as it should. The added code is between the comment "start/stop support Russian character":
http://support.maash.ru/posting_functions.inc.php.zip
Re: National characters in the filename of the attachment
Posted: Tue May 05, 2015 3:44 pm
by Klemen
Thanks for testing and your solution, but I'll try to find something that will work with other language chars as well, not just Cyrillic.
Would you be kind enough and:
1. create a few files with names you are having problems with
2. place all those files in a single zip file
3. send me a link to download the zip file
I will then be able to work and test without having to bother you

Re: National characters in the filename of the attachment
Posted: Wed May 06, 2015 10:51 am
by Bat1
http://support.maash.ru/cyrillic-filename.zip
Within each file the correct version conversion.
Thank you for your work on my problem.
Re: National characters in the filename of the attachment
Posted: Wed May 06, 2015 6:44 pm
by Klemen
Thanks for uploading the files.
I see what the problem is - the file names are not in UTF-8 hence the chars are not converted properly (text inside is in utf-8).
I'm not sure supporting all possible file name encoding will be included in HESK. I will see what I can do but for the sake of simplicity and light-weightiness it will probably stay with any non-utf8 chars being deleted.
Re: National characters in the filename of the attachment
Posted: Thu May 07, 2015 7:49 am
by Bat1
No, no ... Conversion now is working as it should. Just need fix the problem, which removes the first word in the filename. But must will be removed the not Unicode characters only after the conversion. Then Cyrillic will be processed and your basic idea of converting the symbols of other encodings will not be affected.