Bug 145201 - Give StringView a utf8() API.
Summary: Give StringView a utf8() API.
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
Depends on:
Reported: 2015-05-19 20:31 PDT by Andreas Kling
Modified: 2015-05-20 08:30 PDT (History)
3 users (show)

See Also:

Patch (10.75 KB, patch)
2015-05-19 20:40 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (6.99 KB, patch)
2015-05-19 20:41 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
Comment 2 Andreas Kling 2015-05-19 20:41:19 PDT
Created attachment 253423 [details]
Comment 3 WebKit Commit Bot 2015-05-19 22:58:03 PDT
Comment on attachment 253423 [details]

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]

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.