diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaderUtil.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaderUtil.java
index <HASH>..<HASH> 100644
--- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaderUtil.java
+++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaderUtil.java
@@ -252,9 +252,16 @@ public final class HttpHeaderUtil {
     static void encodeAscii0(CharSequence seq, ByteBuf buf) {
         int length = seq.length();
         for (int i = 0 ; i < length; i++) {
-            buf.writeByte((byte) seq.charAt(i));
+            buf.writeByte(c2b(seq.charAt(i)));
         }
     }
 
+    private static byte c2b(char c) {
+        if (c > 255) {
+            return '?';
+        }
+        return (byte) c;
+    }
+
     private HttpHeaderUtil() { }
 }
Safely encode Strings to ASCII

(Ported @luciferous's changes against <I>)

Motivation:

The current implementation of the encoder writes each character of the
String as a single byte to the buffer, however not all characters are
mappable to a single byte.

Modifications:

If a character is outside the ASCII range, it's converted to '?'.

Result:

A safer encoder for String to ASCII, which substitutes unmappable
characters with'?'.