The code below is a function populating a drop down list with the all the folders contained in a specific folder.
It works fine until it encounters folders named with french accents: they are not displayed correctly, and they give me errors, when I try to use their names as strings in other related functions:
I’m not very familiar with how encodings work, but how can I force it to recognize these characters and display them correctly?
And to extend the question, is it possible to make it recognize any characters from any language for the matter?
Here are the relevant parts of the code:
import codecs [...] list_of_category_folders =  for folder in os.listdir(lib_path): if os.path.isdir(os.path.join(lib_path, folder)): folder = codecs.decode(folder, encoding='utf-8', errors='strict') #This is what I tried but it gives me an error list_of_category_folders.append(folder) return [(name, name, "") for name in list_of_category_folders]