On Tue, Apr 28, 2009 at 2:31 PM, Peter Kasting <[email protected]> wrote:

> On Tue, Apr 28, 2009 at 1:39 PM, Greg Spencer <[email protected]> wrote:
>
>> 1) I'd like to add some explicit routines for converting to/from UTF8 and
>> UTF16.  While it's nice (and important) that FilePath uses the platform's
>> native string, we've found that many third party libraries have made other
>> assumptions, where they always expect UTF8 (char) or UTF16 (wchar_t) paths
>> regardless of platform, and converting a FilePath to and from those forms is
>> a platform-dependent exercise which should be centralized into the class
>> (i.e. adding "ToUTF8" and "ToWide" functions to the class, and explicit
>> constructors that take each type).
>
>
> I'm pretty strongly against this for the same reasons as Evan.  I think
> consumers who need to convert should be doing the conversion using their own
> routines (e.g. Chrome uses ones in our base/ module).
>

So, I was unable to find the conversion utilities in base that do the
conversion to/from UTF8.  What are they called?  If I missed them (and I
looked for a while before I gave up), then maybe they need to be more
prominent?

What is the danger here of being lazy?  Is it that developers will
unwittingly do expensive conversions?  If so, I would expect that a member
function called "ToUTF8" would be just as much of a performance warning as a
helper function called "FilePathToUTF8", but be a heck of a lot more
convenient (since it would not require the developer to create a local
variable for use as a return value from the helper, and can be used as an
argument to another library's functions).  I can see the argument for not
having a casting constructor that isn't from the platform native form, but
in that case, a factory method called "CreateFromUTF8" should be a
sufficient warning to the developer that it might be expensive.

-Greg.

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: [email protected] 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to