git://git.nikiroo.be
/
nsub.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2285e09
)
nsub: add utf-8 BOM support
author
Niki Roo
<niki@nikiroo.be>
Thu, 26 May 2022 11:50:47 +0000
(13:50 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Thu, 26 May 2022 11:50:47 +0000
(13:50 +0200)
src/nsub/nsub.c
patch
|
blob
|
blame
|
history
diff --git
a/src/nsub/nsub.c
b/src/nsub/nsub.c
index 3df4da0c34c9f9f51e9fd1113c59c4dfd496d5ae..0ea748f52978574ae96629dc1f5fe8a53c809da8 100644
(file)
--- a/
src/nsub/nsub.c
+++ b/
src/nsub/nsub.c
@@
-128,6
+128,13
@@
song_t *nsub_read(FILE *in, NSUB_FORMAT fmt) {
line = new_cstring();
size_t i = 0;
while (cstring_readline(line, in)) {
+ // UTF-8 BOM detection if any
+ if (!i && cstring_starts_with(line->string, "\xEF\xBB\xBF", 0)) {
+ cstring_t *tmp = cstring_substring(line->string, 3, 0);
+ free_cstring(line);
+ line = tmp;
+ }
+
i++;
if (!read_a_line(song, line->string)) {