Bug 145201

Summary: Give StringView a utf8() API.
Product: WebKit Reporter: Andreas Kling <kling>
Component: Web Template FrameworkAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cmarcelo, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Andreas Kling 2015-05-19 20:31:58 PDT
It would be nice if StringView had an API like String::utf8().
Comment 1 Andreas Kling 2015-05-19 20:40:22 PDT
Created attachment 253422 [details]
Patch
Comment 2 Andreas Kling 2015-05-19 20:41:19 PDT
Created attachment 253423 [details]
Patch
Comment 3 WebKit Commit Bot 2015-05-19 22:58:03 PDT
Comment on attachment 253423 [details]
Patch

Clearing flags on attachment: 253423

Committed r184617: <http://trac.webkit.org/changeset/184617>
Comment 4 WebKit Commit Bot 2015-05-19 22:58:06 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Darin Adler 2015-05-20 08:30:11 PDT
Comment on attachment 253423 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=253423&action=review

> Source/WTF/wtf/text/StringImpl.h:519
> +    static WTF_EXPORT_STRING_API CString utf8ForCharacters(const LChar* characters, unsigned length);
>      static WTF_EXPORT_STRING_API CString utf8ForCharacters(const UChar* characters, unsigned length, ConversionMode = LenientConversion);

For future consideration: It’s peculiar that these two functions are members of StringImpl. They would make more sense in the CString class itself, as free functions in UTF8.h, or possibly as members of StringView, which encapsulates character pointers and lengths.