Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non english filenames in windows apache #42

Open
kofbox opened this issue Apr 4, 2016 · 17 comments
Open

Non english filenames in windows apache #42

kofbox opened this issue Apr 4, 2016 · 17 comments

Comments

@kofbox
Copy link

kofbox commented Apr 4, 2016

Hey. I tried to use this script in xampp on Windows. At the same time, I store files with names in different encodings. Encode Explorer does not correctly display these names.

On the Internet I found the solution here:
http://php.net/manual/ru/function.urldecode.php
(Comment by "alejandro at devenet dot net")

And here:
https://www.w3.org/International/questions/qa-forms-utf-8.en

I made the appropriate changes in the code (very little) and now everything is working as it should in Windows.

Attached Encode Explorer with corrections. I would be glad if it will be accepted in the following versions of Encode Explorer. :)

index.txt

NewEraCracker added a commit to NewEraCracker/encode-explorer that referenced this issue Apr 5, 2016
@NewEraCracker
Copy link
Contributor

Hello,

Can you please test the changes I've made:
https://github.com/NewEraCracker/encode-explorer/blob/feature/index.php

And let me know if they fix your problem?

Remember changing $_CONFIG['os_charset'] = "UTF-8"; to $_CONFIG['os_charset'] = "CP1251"; for it to behave correctly on your environment.

Also I'd appreciate you testing behavior with mbstring enabled and disabled, so that we can test both mbstring (mb_convert_encoding) and iconv conversion capabilities.

Regards.

@kofbox
Copy link
Author

kofbox commented Apr 5, 2016

I tested. If you change the $ _CONFIG [ 'os charset'] = "CP1251" are all displayed correctly in the frontend. However, the links to files are not built correctly. On Windows, you need to link to the file built using iconv, but references to the folder were built as they are being built right now. All this is taken into account in a file that is embedded in my first post. Also see the screenshots.
good
not-good

@NewEraCracker
Copy link
Contributor

I have changed the code slightly: f3c33dc
Let me know if the problem is fixed now.

@kofbox
Copy link
Author

kofbox commented Apr 5, 2016

@NewEraCracker
Copy link
Contributor

Try again please and let me know the outcome. I now keep href attribute as-is and only change the text that is shown.

Also made code more generic.

@kofbox
Copy link
Author

kofbox commented Apr 5, 2016

Change your code at line 3183 to:
print "\t\t<a href=\"".$this->location->getDir(false, true, false, 0, true).$file->getNameHtml(true)."\"";

and its be what we all want :)

@havet
Copy link
Contributor

havet commented Apr 5, 2016

Hi,
I've proposed an other solution using iconv:

  1. On upload:
    // Konversion utf-8 > ISO. PT
    $name = iconv ("UTF-8", "ISO-8859-1", $name); //PT

  2. On displaying the content:
    // Konversion ISO > UTF-8. PT
    $folder = iconv ("ISO-8859-1", "UTF-8", $folder); //PT
    print($folder);
    and
    // Konversion ISO > UTF-8. PT
    $fil = $file->getName(); // PT testar
    $fil = iconv ("ISO-8859-1", "UTF-8", $fil); // PT
    print $fil;

This works, but I don't know if this is the best way of doing it.

NewEraCracker added a commit to NewEraCracker/encode-explorer that referenced this issue Apr 5, 2016
@kofbox
Copy link
Author

kofbox commented Apr 5, 2016

havet, your method not working, after this code text shows like that:

àðãóìåíòîâ

@NewEraCracker
Copy link
Contributor

Russian vs Swedish. Cyrillic vs Latin... ASCII is of many languages but only one at a time.

@havet: I think I found a transparent way of dealing with the usual encoding issues. Can you test the current code on my fork listing files (and directories) with Swedish filenames, while having set $_CONFIG['os_charset'] = "CP1252"; for your system.

I have done the change that @kofbox sugested. My best idea about why it is needed is because webserver uses UTF-8 winAPI instead of ASCII (unlike PHP).

Thank you both for your input and feedback! I want to tackle this weird encoding bugs to my best knowledge.

@kofbox
Copy link
Author

kofbox commented Apr 5, 2016

NewEraCracker, also, if i set
$_CONFIG['lang'] = "ru";
and save file index.php in UTF-8 codepage with BOM - some elements not showing. If without BOM - then all ok.

You may want to edit 11 line to:

  • NB!:If you change anything, save with UTF-8 without BOM! Otherwise you may

@NewEraCracker
Copy link
Contributor

done.

Now waiting for further feedback and opinion of project owner.

@kofbox kofbox closed this as completed Apr 5, 2016
@kofbox kofbox reopened this Apr 9, 2016
NewEraCracker added a commit to NewEraCracker/encode-explorer that referenced this issue Jul 31, 2016
Encoding translation is now more transparent and handled in a logical,
albeit hackish, way.

Thanks to @havet and @kofbox for their feedback.
Will be followed by a commit that handles the basename() issue.

Tested and working when encode-explorer is running on Windows platform.
NewEraCracker added a commit to NewEraCracker/encode-explorer that referenced this issue Jul 31, 2016
Encoding translation is now more transparent and handled in a logical,
albeit hackish, way.

Thanks to @havet and @kofbox for their feedback.
Will be followed by a commit that handles the basename() issue.

Tested and working when encode-explorer is running on Windows platform.
@xmodpt
Copy link

xmodpt commented Sep 10, 2016

hello all

grear job and i am loving it aldo i am have some problems with it.

in portugal we have some dif chars like " ç á à ã â " etc...
In the index file all show's ok but the scan resaults that's where the problems begin.
as you can see by the image, in the footer section of the frame the chars show's ok ( set $_CONFIG['lang'] = "pt_PT"; ) in the index file but when it scans the files, any file that have any special char it comes out as blank.

Any ideas ?

kind regards
XmodPT

image

@NewEraCracker
Copy link
Contributor

Boa tarde,

Usa a versão disponível aqui: https://github.com/NewEraCracker/encode-explorer e edita a seguinte linha
$_CONFIG['os_charset'] = "UTF-8"; para $_CONFIG['os_charset'] = "CP1252";

Cumprimentos,
Jorge Oliveira aka NewEraCracker

@xmodpt
Copy link

xmodpt commented Sep 11, 2016

Boas tardes joao

Muito obrigado pela ajuda.

Bom fds

Nuno Pires

Em 11/09/2016 15:05, "Jorge Oliveira" [email protected] escreveu:

Boa tarde,

Usa a versão disponível aqui: https://github.com/
NewEraCracker/encode-explorer e edita a seguinte linha
$_CONFIG['os_charset'] = "UTF-8"; para $_CONFIG['os_charset'] = "CP1252";

Cumprimentos,
Jorge Oliveira aka NewEraCracker


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#42 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AU--DtaGXcjvOSSE6ufmMBjN15LdGGxZks5qpAq3gaJpZM4H_cG3
.

@xmodpt
Copy link

xmodpt commented Sep 11, 2016

Dear NewEraCracker

Thank you for all your help.
Your sugestion worked like a charm.

Once again TY

Regards
Nuno Pires
AKA XmodPT

@xmodpt
Copy link

xmodpt commented Sep 12, 2016

hello Jorge

Thank you for all the help but here i come again with another question:

Is there any way to "Force download" insted of opening in a new window ?

Thank you once more

regards

NP

2016-09-11 15:14 GMT+01:00 Nuno Pires [email protected]:

Boas tardes joao

Muito obrigado pela ajuda.

Bom fds

Nuno Pires

Em 11/09/2016 15:05, "Jorge Oliveira" [email protected] escreveu:

Boa tarde,

Usa a versão disponível aqui: https://github.com/NewEraCrack
er/encode-explorer e edita a seguinte linha
$_CONFIG['os_charset'] = "UTF-8"; para $_CONFIG['os_charset'] = "CP1252";

Cumprimentos,
Jorge Oliveira aka NewEraCracker


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#42 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AU--DtaGXcjvOSSE6ufmMBjN15LdGGxZks5qpAq3gaJpZM4H_cG3
.

@xmodpt
Copy link

xmodpt commented Sep 12, 2016

second question:

is there a way to make the code detect if it is being opened on a cellphone
so it automatically changes to "mobile" version ?

On 12 September 2016 at 22:13, Nuno Pires [email protected] wrote:

hello Jorge

Thank you for all the help but here i come again with another question:

Is there any way to "Force download" insted of opening in a new window ?

Thank you once more

regards

NP

2016-09-11 15:14 GMT+01:00 Nuno Pires [email protected]:

Boas tardes joao

Muito obrigado pela ajuda.

Bom fds

Nuno Pires

Em 11/09/2016 15:05, "Jorge Oliveira" [email protected]
escreveu:

Boa tarde,

Usa a versão disponível aqui: https://github.com/NewEraCrack
er/encode-explorer e edita a seguinte linha
$_CONFIG['os_charset'] = "UTF-8"; para $_CONFIG['os_charset'] =
"CP1252";

Cumprimentos,
Jorge Oliveira aka NewEraCracker


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#42 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AU--DtaGXcjvOSSE6ufmMBjN15LdGGxZks5qpAq3gaJpZM4H_cG3
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants