[plt-scheme] weird utf-8 servlet output

From: Aycan iRiCAN (aycan.irican at core.gen.tr)
Date: Tue Oct 17 19:54:20 EDT 2006

Jens Axel Søgaard <jensaxel at soegaard.net> writes:

> Aycan iRiCAN skrev:
>
>> Looking at the source of the output some characters lost at the end:
>>
>> "<html><head><meta content="text/html; charset=utf-8;" http-equiv="Content-Type" /><title>Sample</title></head><body><h1>Türkçe</h1></body></html"
>
> Did you try more than one browser? (Just to rule out
> an unfortunate browser<->server interaction.)
>
> Or maybe it is related to bug 7222?

Hmm yes, it's the bug 7222. I quickly looked at the response.scm
source. I think the content-length of the response have been computed
badly around line 147.

...
(apply + (map
           (lambda (c)
              (if (string? c)
                  (string-length c)   ;; here it is
                  (bytes-length c)))
           (cdr resp)))
...

Here is a demonstration of the situation;

> (string-length "şişko")
5
> (bytes-length (string->bytes/locale "şişko"))
7

I tried to convert the string to bytes before deciding it's length
(using something like the demo above) but I got this error:

compile: variable not provided (directly or indirectly and at the expected position) from module: |,/usr/local/plt/lib/plt/collects/web-server/response| in: provide/contract-contract-id-TEXT/HTML-MIME-TYPE.11

Best Regards,

-- 
Aycan iRiCAN
C0R3 Computer Security Group
http://people.core.gen.tr/~aycan.irican/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20061018/243b1022/attachment.sig>

Posted on the users mailing list.