blob: db1402fa71ff8aa7095c4857a2eb231ffbf78a97 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "charencoding.h"
#include "libnewsboat-ffi/src/charencoding.rs.h"
namespace newsboat {
namespace charencoding {
nonstd::optional<std::string> charset_from_bom(std::vector<std::uint8_t> content)
{
rust::String charset;
const auto input = rust::Slice<const std::uint8_t>(content.data(), content.size());
if (charencoding::bridged::charset_from_bom(input, charset)) {
return std::string(charset);
}
return {};
}
nonstd::optional<std::string> charset_from_xml_declaration(std::vector<std::uint8_t>
content)
{
rust::String charset;
const auto input = rust::Slice<const std::uint8_t>(content.data(), content.size());
if (charencoding::bridged::charset_from_xml_declaration(input, charset)) {
return std::string(charset);
}
return {};
}
} // namespace charencoding
} // namespace newsboat
|