Fix Content-Type charser fix for non-quoted mode
[yaz-moved-to-github.git] / src / srwutil.c
index 5a4f576..e1c9546 100644 (file)
@@ -242,6 +242,8 @@ static void grab_charset(ODR o, const char *content_type, char **charset)
             *charset = odr_strdup(o, charset_p);
             while (charset_p[i] && charset_p[i] != sep)
             {
             *charset = odr_strdup(o, charset_p);
             while (charset_p[i] && charset_p[i] != sep)
             {
+                if (!sep && strchr("; \n\r", charset_p[i]))
+                    break;
                 if (charset_p[i] == '\\' && charset_p[i+1])
                     i++;
                 (*charset)[j++] = charset_p[i++];
                 if (charset_p[i] == '\\' && charset_p[i+1])
                     i++;
                 (*charset)[j++] = charset_p[i++];