National characters in the filename of the attachment

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
Bat1
Posts: 6
Joined: Wed Apr 15, 2015 2:26 pm

National characters in the filename of the attachment

Post 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.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: National characters in the filename of the attachment

Post 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)?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Bat1
Posts: 6
Joined: Wed Apr 15, 2015 2:26 pm

Re: National characters in the filename of the attachment

Post 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','Ъ'=>'','Ь'=>''));
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: National characters in the filename of the attachment

Post by Klemen »

I don't promise but will look into it :wink:
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Bat1
Posts: 6
Joined: Wed Apr 15, 2015 2:26 pm

Re: National characters in the filename of the attachment

Post 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.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: National characters in the filename of the attachment

Post 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).
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: National characters in the filename of the attachment

Post 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?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Bat1
Posts: 6
Joined: Wed Apr 15, 2015 2:26 pm

Re: National characters in the filename of the attachment

Post 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
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: National characters in the filename of the attachment

Post 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 :wink:
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Bat1
Posts: 6
Joined: Wed Apr 15, 2015 2:26 pm

Re: National characters in the filename of the attachment

Post by Bat1 »

http://support.maash.ru/cyrillic-filename.zip
Within each file the correct version conversion.
Thank you for your work on my problem.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: National characters in the filename of the attachment

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Bat1
Posts: 6
Joined: Wed Apr 15, 2015 2:26 pm

Re: National characters in the filename of the attachment

Post 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.
Post Reply