File name in different language problem?

File name in different language problem?

by Ekachai Singthong -
Number of replies: 5

Hello everyone.

I uploaded files to first page course moodledata folder via ftp client program. Thai files named in Thai language. In FTP client program it show name of that files correctly but in Moodle it show ugly text. I try to add resource 'link to file or webpage' and can choose that ugly text files but when finish and display it don't work with error 'Sorry, the requested file could not be found'

Can moodle support different language file name?

Attachment 03.gif
Average of ratings: -
In reply to Ekachai Singthong

Re: File name in different language problem?

by hussein s -

Hi Ekachai

Moodle does support different language file names; however, the database file needs to be properly setup from the beginning. I ran into the same problem before when I uploaded Arabic filenames.

1- the database needs to be utf-8

2- the collation needs to be utf8_unicode_ci

3- these need to be done when the file has no data (before adding any files).

Otherwise, you would need to change each field's collation manually

in addition to setting up the file as in 1) and 2).

If you are already on a server, this last process can be done using a php script.

Hope this helps.

Regards.

H. Sharafeddin

In reply to hussein s

ตอบ: Re: File name in different language problem?

by Ekachai Singthong -

Thank you Hussein S. for your rapid reply.

I completly sure my database use utf8 in any table and field for collect charactor data.

I scan in source code and found that readdir() function not support utf-8 filename.

I search in Google for solution but not work at all.

Anyone have alternative solution please help me.

In reply to hussein s

ตอบ: Re: File name in different language problem?

by Ekachai Singthong -

I accidental found solution for this.

I follow one solution I found from Google he suggest me to use

$file = iconv('iso-8859-1','utf-8',$file);

but not work for my environment.

I try to changed original encoding in varius type it should be and found my system use windows-874 encoding. Then I hack files/index.php about line 722 before $filelist[] = $file;
and insert additional code as this

$file = iconv( "windows-874","utf-8" , $file );

It works for my environments.

In reply to Ekachai Singthong

Re: ตอบ: Re: File name in different language problem?

by mohammaed moreb -

I tray your soultion ตอบ and i tray the encoding windows-874 , iso-8859-1 but the problem cant solve and i use windows 2008 can you help me to solve it.

thanks

In reply to mohammaed moreb

Re: ตอบ: Re: File name in different language problem?

by Anthony Aoun -

I have the same problem and I am using windows server 2012.

Is there a solution for this error ?