Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

i18n: Skip utf-8 BOMs in lang files

  • Loading branch information...
commit 00fb912e6a4e0f2d9c0cb4c603e9a80ebbf882fb 1 parent 34ba784
Andreas Öman authored August 05, 2011

Showing 1 changed file with 8 additions and 0 deletions. Show diff stats Hide diff stats

  1. 8  src/i18n.c
8  src/i18n.c
@@ -333,6 +333,10 @@ nls_load_lang(const char *path)
333 333
   }
334 334
 
335 335
   s = data;
  336
+  // Skip UTF-8 BOM
  337
+  if(!memcmp(s, (const uint8_t []){0xef, 0xbb, 0xbf}, 3))
  338
+    s+=3;
  339
+
336 340
   int l;
337 341
   nls_string_t *ns = NULL;
338 342
   for(; l = strcspn(s, "\r\n"), *s; s += l+1+strspn(s+l+1, "\r\n")) {
@@ -408,6 +412,10 @@ nls_lang_metadata(const char *path, char *errbuf, size_t errlen,
408 412
   *native = 0;
409 413
 
410 414
   s = data;
  415
+  // Skip UTF-8 BOM
  416
+  if(!memcmp(s, (const uint8_t []){0xef, 0xbb, 0xbf}, 3))
  417
+    s+=3;
  418
+
411 419
   int l;
412 420
   for(; l = strcspn(s, "\r\n"), *s; s += l+1+strspn(s+l+1, "\r\n")) {
413 421
     s[l] = 0;

0 notes on commit 00fb912

Please sign in to comment.
Something went wrong with that request. Please try again.