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

"Menu--Get List ", Chinese file names and special symbols have encoding confusion issues. #762

Closed
leo-580 opened this issue Oct 5, 2024 · 15 comments
Labels
enhancement New feature or request

Comments

@leo-580
Copy link

leo-580 commented Oct 5, 2024

@rejetto Feedback issue:

"Menu--Get list" ,Chinese file names and special symbols have encoding confusion issues (it may be related to UTF-8, but I don't know where to set it).

(Used in Windows, "hfs-windows-x64-0.53.1“)

Chinese file names have encoding confusion issues

@leo-580 leo-580 added the bug Something isn't working label Oct 5, 2024
@leo-580 leo-580 changed the title "Menu--Get List ", there is a coding confusion issue with the Chinese file name "Menu--Get List ", Chinese file names and special symbols have encoding confusion issues. Oct 5, 2024
@rejetto
Copy link
Owner

rejetto commented Oct 5, 2024

what do you mean by "confusion" ?
what is the problem with that result? those links work correctly, right?
what did you expect?

@leo-580
Copy link
Author

leo-580 commented Oct 5, 2024

@rejetto
My expectation is that in the next version, you can fix the issue of garbled file names obtained from 'Menu -- Get List'.

Because if there are many files, the "Get List" function should be very useful. If it's not troublesome, please fix it in the next version. Thank you.

After all, we all hope that New HFS is perfect. ^_^

@rejetto
Copy link
Owner

rejetto commented Oct 5, 2024

I understand that those links are unreadable.
"Get list" feature is not designed for human usage, but for automated tools.
I'm using a standard function for url encoding, the one of the browser itself, and it decided that unicode characters must be encoded too.
I tried to not encode unicode characters, and it seems to work, but I'm not sure if it's safe for all usages. Maybe it doesn't work with old browsers. I made a test with firefox 40, but found no problem.
I'm open to make a test. I give you this version, will you help me by using it and report problems?
https://github.com/user-attachments/files/17266301/hfs-windows-x64-0.54.0-beta5.1.zip
right-click on the "check for updates" button, and paste this link

@leo-580
Copy link
Author

leo-580 commented Oct 5, 2024

@rejetto

I am happy to test, and here is my test feedback:

(I used 'hfs-windows-x64-0.54.0-beta5.1.zip'“)

  1. Firstly, I upgraded "Microsoft Edge" to the latest "129.0.2792.79 (official version) (64 bit)".

  2. The file name this time includes "Chinese", "Russian", "Korean", and "Japanese"; Special symbols such as "RMB ¥", "Ruble ₽", "USD $", "Euro €", and "Pound £" seem to be correctly obtained by "Menu -- Get List".

  3. . However, if the file name contains "space", there will be a problem with URL transcoding, resulting in "% 20" encoding.

If the file name contains 【spaces】 it will be garbled

@TEA-Time1
Copy link

That is completely normal. %20 (not % 20) represents a space in encoded text, because an actual space is also used as parameter separators and such, so %20 is used to represent a space in a string that needs to stay together.

@rejetto
Copy link
Owner

rejetto commented Oct 5, 2024

%20 is necessary, it's not a "problem", it's just ugly. A link cannot have a space.

@rejetto rejetto added enhancement New feature or request and removed bug Something isn't working labels Oct 5, 2024
@leo-580
Copy link
Author

leo-580 commented Oct 5, 2024

@rejetto @TEA-Time1

I realize that “spaces” and “%20” are necessary in coding and can't really be hidden.

From a user's visual point of view, this looks strange.
I've done some searching to see if it's possible to add a style attribute such as “white-space: nowrap” (force no line breaks) to the CSS to avoid spaces in the text, and thus spacing, so that spaces in the coding are less visually obvious. (I've encountered cases where the “%20” was hidden when the page displayed spaces; I don't know what method was used to do this (it could have been visual deception using CSS's transparent color or white color), and I forget where I saw it).

Of course, none of this may be a functionality-impacting issue, just bringing it up for discussion and sharing from the perspective of a more perfect HFS.

@rejetto
Copy link
Owner

rejetto commented Oct 5, 2024

the thing you've found is html/css, and it has nothing to do with links.
the content of get-list is not a web page, it is simple text, like a txt file, and has no formatting.

can you tell me what are you using the "get list" for?

@leo-580
Copy link
Author

leo-580 commented Oct 7, 2024

%20 is necessary, it's not a "problem", it's just ugly. A link cannot have a space.

In practice, if there is a space in the link, the browser (such as “Microsoft Edge”) it will be automatically converted to add “%20”, I tested the following two ways, are able to open and display the normal “txt” text.

http://192.168.2.107/Q1/B/0_使用说明★先%20看¥¥.txt“
http://192.168.2.107/Q1/B/0_使用说明★先 看¥¥.txt“

@rejetto
Copy link
Owner

rejetto commented Oct 7, 2024

as you see, the second doesn't work

@leo-580
Copy link
Author

leo-580 commented Oct 7, 2024

as you see, the second doesn't work

Forgot to tell you. I'm using a Simplified Chinese OS and a Chinese browser, I've tested multiple browsers, and it opens both ways. (Maybe it has something to do with the system language too)

"http://192.168.2.107/Q1/B/0_使用说明★先%20看¥¥.txt"
"http://192.168.2.107/Q1/B/0_使用说明★先 看¥¥.txt"

@leo-580
Copy link
Author

leo-580 commented Oct 7, 2024

the thing you've found is html/css, and it has nothing to do with links. the content of get-list is not a web page, it is simple text, like a txt file, and has no formatting.

can you tell me what are you using the "get list" for?

I personally use it now, mainly to see what folders and files are in the directory, because after I share it with others, they add many new subfolders and files, with “Get List” it's easy to see at a glance, but of course I don't rule out the possibility of using “Get List “ to do further automatic list use.

Because I am a non-programmer, may not find examples appropriate enough, should these methods will be linked to get the space (%20) encoding conversion will be some help, here will not expand:
1, the replacement function (simple replacement)
2, TypeScript decorator or JavaScript proxy program
3, data preprocessing or caching (precompiled regular expressions)
4, Parallel and asynchronous processing

You may also be concerned that adding transformations will pose challenges to the efficiency, performance, and stability of your program execution.

But from the perspective of a perfect HFS, it's all worth it. ^_^

@rejetto
Copy link
Owner

rejetto commented Oct 7, 2024

Forgot to tell you. I'm using a Simplified Chinese OS and a Chinese browser, I've tested multiple browsers, and it opens both ways. (Maybe it has something to do with the system language too)

what do you mean by "it opens"? Tell me where and how are you doing your test.
Try to use screenshots or video, as I think there's some misunderstanding going on.

When I look at your post here on github, the second link is broken, this is a screenshot just to be sure we are looking at the same thing:
image
you see, it breaks at the space, and that's normal. A valid URL cannot have a space.

@leo-580
Copy link
Author

leo-580 commented Oct 7, 2024

What I mean is: when I use the link without “%20”, I replace the “%20 position” with “space” and still open the link.
It's like this : http://192.168.2.107/Q1/B/0_使用说明★先 看¥¥.txt
I've noticed that Github seems to treat characters before a space as the end of a link, and characters after a space as regular text.
(This may cause you to misunderstand).

(After “Enter” in the browser, the browser will automatically replace the “space” I used with “%20” as in the picture.)
AAAAA

@rejetto
Copy link
Owner

rejetto commented Oct 7, 2024

ok, thanks to your screenshot now it's clear what you meant.
what you are doing is to paste the link in the browser.
the browser automatically replaces it with %20 because the space is not valid.
When you try to do the same here on github, it doesn't work.
This same problem will apply to many other places.
"get list" is designed to produce valid links, that always work, not just when you copy & paste in the browser.
The %20 in the get-list is not a problem, is a necessity. I understand that you don't like it for your usage, but this is not enough to change it, sorry.

@rejetto rejetto closed this as completed Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants