Mar
31
accepted How can Python check if a file name is in UTF8?
Oct
29
comment How can Python check if a file name is in UTF8?
You are right. Your solution is the best so far and it solves most of the problem. I gave you the credit back. Well done and many thanks. Regardless - this programming problem needs more development. Maybe I will continue it in a new question, as you suggested.
Oct
29
awarded Commentator
Oct
28
comment How can Python check if a file name is in UTF8?
Your method is very nice, but so far I could not use it because it often creates huge file names that windows cannot write/read (more than 255 characters). Any other ideas?
Oct
9
awarded Scholar
Oct
8
comment How can Python check if a file name is in UTF8?
What I want to do is very basic - to read a file name using PHP. However, PHP in windows OS cannot see file names in foreign languages such as: 你好.txt , 안녕하세요.html, chào.doc . You can try it by yourself by creating such files and try to list them using PHP (glob, scandir, etc'). If you succeed, please let me know how you did it.
Oct
3
comment How can Python check if a file name is in UTF8?
PHP cannot even see these file names. After I convert them to UTF8 (using Python), PHP can finally see them. When PHP is able to access these files, then I can continue from this point in any way I choose. It is true that after conversion to UTF8 file names look like Gibberish, but I don't mind because I know that this Gibberish is UTF8 and I can do any conversion that I need within PHP. In PHP I get a string, not an object.
Oct
3
awarded Student
Oct
3
comment How can Python check if a file name is in UTF8?
I have added examples of file names at the end of my question above.
Oct
3
revised How can Python check if a file name is in UTF8?
added 86 characters in body
Oct
3
comment How can Python check if a file name is in UTF8?
Please note that the result of the decoding does not go to any variable. Do you still think there is a contradiction?
Oct
3
comment How can Python check if a file name is in UTF8?
I am trying to decode to see if variable infile is in UTF8 or not. If decoding fails, it means that it was never encoded in UTF8 so it can be encoded now.
Oct
3
comment How can Python check if a file name is in UTF8?
The error is exactly what I wrote. If you try to run this code and,as an input, use a file name in Asian/Russian/Arabic language, you will get exactly the same error.
Oct
2
revised How can Python check if a file name is in UTF8?
added 227 characters in body
Oct
2
asked How can Python check if a file name is in UTF8?
Sep
28
awarded Editor
May
1
awarded Tumbleweed