-
Notifications
You must be signed in to change notification settings - Fork 69
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
Unicode issues in Linux and Unix when running the tests. #78
Comments
Just a small note. The tests are failing when executed under an environment with Windows and OSX support Unicode API, so there is no need for Python 2.7 to do any conversion. The tests are passing on Linux with
|
@adiroiban, thank you for the tip! Using UTF-8 locale settings works indeed, but setting $LANG is not enough, I used $LC_ALL. However, even that is not enough all the time, the chosen UTF-8 locale also has to be available in that system, which is not always the case in the Linux / Unix world. |
Does someone know what the right fix for this is? Or is it not a problem with scandir, but just a matter of setting your LANG/LC_ALL environment variables to fix? |
For the tests, the fix is to be explicit about the encoding and don't let Python to do the encoding/decoding for you. So in this code, for example don't pass Unicode to the Python low level API as this will produce various encodings
but instead be explicit and pass bytes which are already encoded
For general usage, I don't know if there is a fix. scandir should not try to do any smart thing with the file names and just pass them as bytes (without trying to decode them) Linux / Unix filesystems are just bytes... so you can store whatever you want as the file name and in whatever format you want Things can get messy and in the same folder have an UTF-8 encoded name, ASCII and EBCDIC |
This happens with scandir 1.5 and Python 2.7.11 in all our Linux, AIX, Solaris, FreeBSD and OpenBSD build slaves, but not on Windows and OS X / Mac OS.
Firstly,
test_basic
fails with the following error:Subsequently, most tests that follow fail with No such file or directory errors, eg.:
Actually, this breaks all scandir tests except the following three:
All excerpts are from an Ubuntu 16.04 build slave, but the errors are common across Linux distributions and Unix varieties and versions. However, OS X / Mac OS and Windows are not affected.
The text was updated successfully, but these errors were encountered: