21.29. squid 瀏覽 ftp 與 gopher 中文亂碼?

by KTH.bbs&alway.twbbs.org

原本學校使用 Squid 2.1,透過它瀏覽 ftp 站台與 gopher 站台訊息不會有亂碼出現,後來多了一台 2.4STABLEX 以後,發現都會有亂碼的產生,稍微追蹤了一下程式, 原來問題出在 2.4x 以後會將 >=0x7f 與 <=0x1f 的字元編碼成 &#%3d 的格式,因此在不影響穩定度的情況下, 就乾脆把這一段程式給註解掉了,這樣就能解決中文亂碼問題了, 用瀏覽器瀏覽起來真的蠻舒服的 ^^

--- lib/html_quote.c.orig       Wed Jun  5 16:02:30 2002
+++ lib/html_quote.c    Wed Jun  5 16:03:07 2002
@@ -114,11 +114,13 @@
         * sure all 8-bit characters are encoded to protect from buggy
         * clients
         */
+#if 0
        if (!escape && (ch <= 0x1F || ch >= 0x7f) && ch != '\n' && ch != '\r' && ch != '\t') {
            static char dec_encoded[7];
            snprintf(dec_encoded, sizeof dec_encoded, "&#%3d;", (int) ch);
            escape = dec_encoded;
        }
+#endif  
        if (escape) {
            /* Ok, An escaped form was found above. Use it */
            strncpy(dst, escape, 6);