On Tue, Apr 28, 2009 at 3:19 PM, Greg Spencer <[email protected]> wrote:
> On Tue, Apr 28, 2009 at 3:11 PM, Erik Kay <[email protected]> wrote: > >> The biggest problem with this change is that it's not possible to do this >> conversion on Linux in a safe way. In Linux, there is no charset defined by >> the filesystem. Each filename is just a blob of bytes. Apps are supposed >> to respect an environment variable, but since this environment variable >> could change over time and be different from user to user, there's no >> reliable way to know what the charset is, so you can't convert from a >> FilePath on Linux to UTF8 or UTF16 unless you were the one who created the >> path to begin with. >> > > But that's exactly the point. FilePath is the class that created the path > to begin with. So it can know what the LC_*/LANG variables were was when it > was created, and do the right conversion when you ask the FilePath to > convert to UTF16. Also, if the developer calls something called > FilePath::CreateFromUTF8, then it can know it was supposed to be UTF8 and > remember that. > If you created it yourself, that's fine. FilePaths aren't always created manually by users. They often are populated from system APIs where you can't know. See file_util* for some examples. So the problem is that if you add this API, people will mistakenly use the conversion functions when they can't be safe. I agree it sucks. I just don't know of a reasonable solution. Erik --~--~---------~--~----~------------~-------~--~----~ Chromium Developers mailing list: [email protected] View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~----------~----~----~----~------~----~------~--~---
