mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
18 lines
401 B
V
18 lines
401 B
V
module util
|
|
|
|
pub fn skip_bom(file_content string) string {
|
|
mut raw_text := file_content
|
|
// BOM check
|
|
if raw_text.len >= 3 {
|
|
unsafe {
|
|
c_text := raw_text.str
|
|
if c_text[0] == 0xEF && c_text[1] == 0xBB && c_text[2] == 0xBF {
|
|
// skip three BOM bytes
|
|
offset_from_begin := 3
|
|
raw_text = tos(c_text[offset_from_begin], vstrlen(c_text) - offset_from_begin)
|
|
}
|
|
}
|
|
}
|
|
return raw_text
|
|
}
|