Chromium Code Reviews| Index: third_party/WebKit/Source/wtf/text/TextEncoding.cpp |
| diff --git a/third_party/WebKit/Source/wtf/text/TextEncoding.cpp b/third_party/WebKit/Source/wtf/text/TextEncoding.cpp |
| index 3b0563887861bc7145b7422c056fe2fc2fca2e15..76aa25a60bb7a718a1145ce0ad4022d60ed7e4f0 100644 |
| --- a/third_party/WebKit/Source/wtf/text/TextEncoding.cpp |
| +++ b/third_party/WebKit/Source/wtf/text/TextEncoding.cpp |
| @@ -84,6 +84,18 @@ CString TextEncoding::encode(const String& string, UnencodableHandling handling) |
| return encodedString; |
| } |
| +CString TextEncoding::encodeBOMifApplicable() const |
| +{ |
| + // TODO(lukasza): Store |textCodec| in a member field, so it can be reused |
| + // across repeated calls to encode and/or encodeBOMifApplicable. |
|
jsbell
2015/12/07 22:53:51
That would change the behavior for stateful encodi
|
| + OwnPtr<TextCodec> textCodec = newTextCodec(*this); |
| + if (!textCodec->shouldIncludeBOM()) |
| + return ""; |
| + |
| + const UChar bomCharacter = 0xFEFF; |
| + return textCodec->encode(&bomCharacter, 1, QuestionMarksForUnencodables); |
| +} |
| + |
| bool TextEncoding::usesVisualOrdering() const |
| { |
| if (noExtendedTextEncodingNameUsed()) |