Am Freitag, 17. November 2006 15:49 schrieb Georg Baum: > Currently we have several UNICODE FIXMEs in the code where we pass an utf8 > encoded filename to an fstream and hope that it will work. This is wrong, > because the encoding of filenames depends on the locale on linux. I don't > know what it is on windows, I never use non-ascii filenames. > > My plan to solve this problem is this: > > - Split the existing FileName class into a general part that can be used for > any filename, and a part that is specialized for files that appear in > documents. This is done by the attached patch. > - Convert both file name classes to docstring > - Store all filenames not as string or docstring, but in the FileName class > and convert all functions that take a filename argument to the FileName > class. That will eliminate a lot of assertions on absolute paths. > - Add a method to the FileName class that returns the name as a std::string > in the right encoding for the file system. > > This will generate rather large, but mechanical patches, but it will > basically not change the code, and it will guarantee that no file name is > stored in the wrong encoding.
This is the first patch that goes in now, big and mechanical. I tested it, and it seems to work, but I could have missed something. In that case you'll get an assertion in the FileName constructor. If that should happen please tell, and it will be easy to fix. The new method FileName::toFilesystemEncoding is a dummy for now, but already used at a lot of places. More will follow, and then I'll convert the internal storage of FileName to be unicode aware. Georg
x.diff.bz2
Description: BZip2 compressed data