diff --git a/compiler2/ttcn3/compiler.l b/compiler2/ttcn3/compiler.l
index b4ddd18e95413e6d9ee67e54c17324d9eac4ccd3..d6c12b1d9d7ff569f5efaae712556a729ce75991 100644
--- a/compiler2/ttcn3/compiler.l
+++ b/compiler2/ttcn3/compiler.l
@@ -791,7 +791,7 @@ NULL RETURN(NullValue);
   }
 
   [a-f] {
-    binstr = mputc(binstr, yytext[0] - 'a' + 'A');
+    binstr = mputc(binstr, yytext[0]);
     valid_bit = false;
     half_oct = !half_oct;
     current_column++;