-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Directory listing in SimpleHTTPRequestHandler does not work well in non-UTF-8 locale #133889
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
Comments
There is no good way that guarantees it will work with simple locale, so why not encode in |
Always using the UTF-8 encoding, as well as the "xmlcharrefreplace" errors handler will fix the failure. But it will also change the page representation. In long run it may be good, but note that currently you get the same binary representation of file names independently from the locale of the server. On other hand, I think that applying |
…rTestCase page The query and the fragment are ambiguous and not used.
…stHandler page The query and the fragment are ambiguous and not used.
…ler page (GH-134135) The query and fragment are ambiguous and not used.
…stHandler page (pythonGH-134135) The query and fragment are ambiguous and not used. (cherry picked from commit 5cbc8c6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…stHandler page (pythonGH-134135) The query and fragment are ambiguous and not used. (cherry picked from commit 5cbc8c6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
For directory, SimpleHTTPRequestHandler generates an index.html page containing a list of files. It uses the filesystem encoding for the page, which is reasonable, because file names are encoded with that encoding. The problem is that the directory patch, included in the title, can contain a query part of the URL, which may be not encodable with the filesystem encoding.
This causes test failure when running in non-UTF8 locale:
I suspect that there may also be issues if some files in the directory have non-decodable or the path of the directory is non-decodable, but I have not tested this yet.
Linked PRs
utf-8
by default inlist_directory
#133975The text was updated successfully, but these errors were encountered: