You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ced_c.cc 803B

12345678910111213141516171819202122232425
  1. #include "ced_c.h"
  2. #include "compact_enc_det.h"
  3. const char* ced_encoding_detect(const char* text, int text_length,
  4. const char* url_hint,
  5. const char* http_charset_hint,
  6. const char* meta_charset_hint,
  7. const int encoding_hint,
  8. CedTextCorpusType corpus_type, bool ignore_7bit_mail_encodings,
  9. int* bytes_consumed, bool* is_reliable)
  10. {
  11. CompactEncDet::TextCorpusType ct = CompactEncDet::NUM_CORPA;
  12. ct = static_cast<CompactEncDet::TextCorpusType>(corpus_type);
  13. auto enc = CompactEncDet::DetectEncoding(text, text_length, url_hint,
  14. http_charset_hint, meta_charset_hint, encoding_hint, default_language(),
  15. ct, ignore_7bit_mail_encodings, bytes_consumed, is_reliable);
  16. if (IsValidEncoding(enc)) {
  17. return MimeEncodingName(enc);
  18. }
  19. return nullptr;
  20. }