diff --git a/ffprobe.c b/ffprobe.c
index bdc3814a5587417dbb38da10c050ca0fa9ee7018..e16c8bf399425cf0e1ae73a28760b2be186e3fd7 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -417,7 +417,11 @@ static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
 {
     int i;
     for (i = 0; src[i] && i < dst_size-1; i++)
-        dst[i] = src[i]-32;
+        if (src[i] >= 'a' && src[i] <= 'z') {
+            dst[i] = src[i]-32;
+        } else {
+            dst[i] = src[i];
+        }
     dst[i] = 0;
     return dst;
 }