Index: apps/misc.h
===================================================================
--- apps/misc.h	(revision 13076)
+++ apps/misc.h	(working copy)
@@ -99,6 +99,8 @@
 int get_replaygain_mode(bool have_track_gain, bool have_album_gain);
 #endif
 
+int open_utf8(const char* pathname, int flags);
+
 #ifdef BOOTFILE
 #ifndef USB_IPODSTYLE
 void check_bootfile(bool do_rolo);
Index: apps/playlist.c
===================================================================
--- apps/playlist.c	(revision 13076)
+++ apps/playlist.c	(working copy)
@@ -510,15 +510,6 @@
         
         p = (unsigned char *)buffer;
 
-        /* utf8 BOM at beginning of file? */
-        if(i == 0 && nread > 3 
-           && *p == 0xef && *(p+1) == 0xbb && *(p+2) == 0xbf) {
-            nread -= 3;
-            p += 3;
-            i += 3;
-            playlist->utf8 = true;  /* Override any earlier indication. */
-        }
-
         for(count=0; count < nread; count++,p++) {
 
             /* Are we on a new line? */
@@ -1298,7 +1289,7 @@
         else
         {
             if(-1 == playlist->fd)
-                playlist->fd = open(playlist->filename, O_RDONLY);
+                playlist->fd = open_utf8(playlist->filename, O_RDONLY);
             
             fd = playlist->fd;
         }
Index: apps/recorder/radio.c
===================================================================
--- apps/recorder/radio.c	(revision 13076)
+++ apps/recorder/radio.c	(working copy)
@@ -1040,7 +1040,7 @@
         snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr",
             FMPRESET_PATH, filename);
     
-    fd = open(filepreset, O_RDONLY);
+    fd = open_utf8(filepreset, O_RDONLY);
     if(fd >= 0)
     {
         while(!done && num_presets < MAX_PRESETS)
Index: apps/settings.c
===================================================================
--- apps/settings.c	(revision 13076)
+++ apps/settings.c	(working copy)
@@ -302,7 +302,7 @@
     char* name;
     char* value;
     int i;
-    fd = open(file, O_RDONLY);
+    fd = open_utf8(file, O_RDONLY);
     if (fd < 0)
         return false;
 
Index: apps/gui/wps_parser.c
===================================================================
--- apps/gui/wps_parser.c	(revision 13076)
+++ apps/gui/wps_parser.c	(working copy)
@@ -906,19 +906,6 @@
 
 #endif /* HAVE_LCD_BITMAP */
 
-/* Skip leading UTF-8 BOM, if present. */
-static char *skip_utf8_bom(char *buf)
-{
-    unsigned char *s = (unsigned char *)buf;
-
-    if(s[0] == 0xef && s[1] == 0xbb && s[2] == 0xbf)
-    {
-        buf += 3;
-    }
-
-    return buf;
-}
-
 /* to setup up the wps-data from a format-buffer (isfile = false)
    from a (wps-)file (isfile = true)*/
 bool wps_data_load(struct wps_data *wps_data,
@@ -955,7 +942,7 @@
         }
 #endif
 
-        int fd = open(buf, O_RDONLY);
+        int fd = open_utf8(buf, O_RDONLY);
 
         if (fd < 0)
             return false;
@@ -988,9 +975,6 @@
         clear_bmp_names();
 #endif
 
-        /* Skip leading UTF-8 BOM, if present. */
-        wps_buffer = skip_utf8_bom(wps_buffer);
-
         /* parse the WPS source */
         if (!wps_parse(wps_data, wps_buffer))
             return false;
Index: apps/misc.c
===================================================================
--- apps/misc.c	(revision 13076)
+++ apps/misc.c	(working copy)
@@ -920,3 +920,22 @@
 }
 #endif
 #endif
+
+/** @brief open a utf-8 file, set file descriptor to first byte.
+ *         Skip BOM if present. Identical to open() otherwise
+ */
+int open_utf8(const char* pathname, int flags)
+{
+    int fd;
+    unsigned char bom[3];
+
+    fd = open(pathname, flags);
+    if(fd < 0) return fd;
+
+    read(fd, bom, 3);
+    /* check for BOM */
+    if(!(bom[0] == 0xef && bom[1] == 0xbb && bom[2] == 0xbf))
+	lseek(fd, 0, SEEK_SET);
+    return fd;
+}
+
Index: apps/recorder/keyboard.c
===================================================================
--- apps/recorder/keyboard.c	(revision 13076)
+++ apps/recorder/keyboard.c	(working copy)
@@ -134,7 +134,7 @@
         return 0;
     }
 
-    fd = open(filename, O_RDONLY|O_BINARY);
+    fd = open_utf8(filename, O_RDONLY|O_BINARY);
     if (fd < 0)
         return 1;
 
Index: apps/cuesheet.c
===================================================================
--- apps/cuesheet.c	(revision 13076)
+++ apps/cuesheet.c	(working copy)
@@ -121,7 +121,7 @@
     char line[MAX_PATH];
     char *s;
 
-    int fd = open(file,O_RDONLY);
+    int fd = open_utf8(file,O_RDONLY);
     if (fd < 0)
     {
         /* couln't open the file */
