diff --git a/HISTORY b/HISTORY index 82107352..e6f1da1b 100644 --- a/HISTORY +++ b/HISTORY @@ -5230,7 +5230,7 @@ Video Disk Recorder Revision History - Changes to the OSD settings in the "Setup/OSD" menu now immediately take effect when the "Ok" key is pressed. -2007-06-15: Version 1.5.4 +2007-06-16: Version 1.5.4 - Increased APIVERSION (forgot to do that in 1.5.2 and 1.5.3). - Fixed a crash in i18n character set conversion (thanks to Alexander Riedel, @@ -5239,3 +5239,4 @@ Video Disk Recorder Revision History - Using nl_langinfo(CODESET) to determine the local codeset to use (thanks to Thomas Günther). The codeset names in 'libsi/si.c' have been changed to the canonical spelling with '-' (thanks to Ludwig Nussel for pointing this out). +- Modified handling invalid characters in VFAT mode. diff --git a/recording.c b/recording.c index 5298de3f..cce99a44 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 1.151 2006/10/07 12:46:22 kls Exp $ + * $Id: recording.c 1.152 2007/06/16 08:57:22 kls Exp $ */ #include "recording.h" @@ -406,34 +406,14 @@ char *ExchangeChars(char *s, bool ToFileSystem) // The VFAT file system can't handle all characters, so we // have to take extra efforts to encode/decode them: if (ToFileSystem) { + const char *InvalidChars = "\"\\/:*?|<>#"; switch (*p) { - // characters that can be used "as is": - case '!': - case '@': - case '$': - case '%': - case '&': - case '(': - case ')': - case '+': - case ',': - case '-': - case ';': - case '=': - case '0' ... '9': - case 'a' ... 'z': - case 'A' ... 'Z': - case 'ä': case 'Ä': - case 'ö': case 'Ö': - case 'ü': case 'Ü': - case 'ß': - break; // characters that can be mapped to other characters: case ' ': *p = '_'; break; case '~': *p = '/'; break; // characters that have to be encoded: default: - if (*p != '.' || !*(p + 1) || *(p + 1) == '~') { // Windows can't handle '.' at the end of directory names + if (strchr(InvalidChars, *p) || *p == '.' && (!*(p + 1) || *(p + 1) == '~')) { // Windows can't handle '.' at the end of file/directory names int l = p - s; s = (char *)realloc(s, strlen(s) + 10); p = s + l; @@ -450,7 +430,7 @@ char *ExchangeChars(char *s, bool ToFileSystem) // mapped characters: case '_': *p = ' '; break; case '/': *p = '~'; break; - // encodes characters: + // encoded characters: case '#': { if (strlen(p) > 2) { char buf[3];