Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Side by Side Diff: base/i18n/encoding_detection.cc

Issue 2168003003: Replace ICU encoding detection with CED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temorarily reverted test files Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/i18n/encoding_detection.h"
6
7 #include "third_party/ced/src/compact_enc_det/compact_enc_det.h"
8
9 namespace base {
10
11 bool DetectEncoding(const std::string& text, std::string* encoding) {
12 int consumedBytes;
13 bool isReliable;
14 Encoding enc = CompactEncDet::DetectEncoding(
15 text.c_str(), text.length(), nullptr, nullptr, nullptr,
16 UNKNOWN_ENCODING,
17 UNKNOWN_LANGUAGE,
18 CompactEncDet::WEB_CORPUS,
19 false, // Include 7-bit encodings
20 &consumedBytes,
21 &isReliable);
22
23 if (enc == UNKNOWN_ENCODING)
24 return false;
25
26 *encoding = MimeEncodingName(enc);
27 return true;
28 }
29 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698