mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibTextCodec: Add BOM sniffer
This takes the input and sniffs it for a BOM. If it has the UTF-8 or UTF-16BE BOM, it will return their respective decoder. Currently we don't have a UTF-16LE decoder, so it will assert TODO if it detects a UTF-16LE BOM. If there is no recognisable BOM, it will return no decoder.
This commit is contained in:
parent
4ccade42b7
commit
94965ba28d
2 changed files with 38 additions and 0 deletions
|
@ -70,4 +70,7 @@ public:
|
|||
Decoder* decoder_for(String const& encoding);
|
||||
Optional<String> get_standardized_encoding(const String& encoding);
|
||||
|
||||
// This returns the appropriate Unicode decoder for the sniffed BOM or nullptr if there is no appropriate decoder.
|
||||
Decoder* bom_sniff_to_decoder(StringView);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue