Re: encoding/decoding clozure strings to/from UTF-8

Rainer Joswig <[email protected]> Mon, 5 Jan 2015 17:25:43 +0100
Newsgroups gmane.lisp.cl-http
Message-ID <[email protected]>
--===============8011210642509560547==
Content-Type: multipart/alternative; boundary="Apple-Mail=_08B02EED-60C0-4D41-89CE-6AACE411F51F"


--Apple-Mail=_08B02EED-60C0-4D41-89CE-6AACE411F51F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

My UTF-8 extension for CL-HTTP on LispWorks already does the necessary =
things. It=E2=80=99s also used in 'production'.

I=E2=80=99ve put in support for Clozure CL. Did a short test and it =
worked for me.

While we are at it, @Martin, can I switch encoding of an open stream in =
LispWorks? Currently the CL-HTTP code does the encoding.

Regards,

Rainer



> Am 05.01.2015 um 17:00 schrieb Martin Simmons <[email protected]>:
>=20
>>>>>> On Wed, 31 Dec 2014 13:50:57 +0100, Karsten Poeck said:
>>=20
>> On 30.12.14 23:57, Mark Klein wrote:
>>> (http:export-url  #u"/test"
>>>                  :computed
>>>                  :response-function #'test)
>>=20
>> That works fine for me, but only if I define the stream that is =
returned=20
>> by the accept-connection like this:
>>=20
>> (ccl:accept-connection socket :wait t :stream-args '(:external-format=20=

>> :utf-8))
>>=20
>> Since this is now a discussion about cl-http and not about Clozure=20
>> Common Lisp, perhaps we continue the discussion on the cl-http =
mailing list.
>>=20
>> For me the key issue is now whether it is a good idea to use utf-8=20
>> streams for a full response header/body.
>>=20
>> In a private mail to us Rainer said that he doubted that - at least I=20=

>> understood it that way - and he probably has good reasons.
>=20
> I think Rainer in correct.  In general, the external format of body =
depends on
> its contents and maybe the request headers, so you can't force it to =
be utf-8
> when the connection is accepted.
>=20
> __Martin
>=20
> _______________________________________________
> WWW-CL mailing list
> [email protected] <mailto:[email protected]>
> https://lists.csail.mit.edu/mailman/listinfo/www-cl =
<https://lists.csail.mit.edu/mailman/listinfo/www-cl>

--Apple-Mail=_08B02EED-60C0-4D41-89CE-6AACE411F51F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D""><div class=3D"">My UTF-8 extension for CL-HTTP on LispWorks =
already does the necessary things. It=E2=80=99s also used in =
'production'.</div><div class=3D""><br class=3D""></div><div =
class=3D"">I=E2=80=99ve put in support for Clozure CL. Did a short test =
and it worked for me.</div><div class=3D""><br class=3D""></div><div =
class=3D"">While we are at it, @Martin, can I switch encoding of an open =
stream in LispWorks? Currently the CL-HTTP code does the =
encoding.</div><div class=3D""><br class=3D""></div><div =
class=3D"">Regards,</div><div class=3D""><br class=3D""></div><div =
class=3D"">Rainer</div><div class=3D""><br class=3D""></div><div =
class=3D""><br class=3D""></div><br class=3D""><div><blockquote =
type=3D"cite" class=3D""><div class=3D"">Am 05.01.2015 um 17:00 schrieb =
Martin Simmons &lt;<a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>&gt;:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><div style=3D"" =
class=3D""><blockquote type=3D"cite" style=3D"font-family: Helvetica; =
font-size: 14px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; orphans: auto; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: =
0px;" class=3D""><blockquote type=3D"cite" class=3D""><blockquote =
type=3D"cite" class=3D""><blockquote type=3D"cite" class=3D""><blockquote =
type=3D"cite" class=3D"">On Wed, 31 Dec 2014 13:50:57 +0100, Karsten =
Poeck said:<br =
class=3D""></blockquote></blockquote></blockquote></blockquote><br =
class=3D"">On 30.12.14 23:57, Mark Klein wrote:<br class=3D""><blockquote =
type=3D"cite" class=3D"">(http:export-url &nbsp;#u"/test"<br =
class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:computed<br =
class=3D"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:response-function #'test)<br =
class=3D""></blockquote><br class=3D"">That works fine for me, but only =
if I define the stream that is returned<span =
class=3D"Apple-converted-space">&nbsp;</span><br class=3D"">by the =
accept-connection like this:<br class=3D""><br =
class=3D"">(ccl:accept-connection socket :wait t :stream-args =
'(:external-format<span class=3D"Apple-converted-space">&nbsp;</span><br =
class=3D"">:utf-8))<br class=3D""><br class=3D"">Since this is now a =
discussion about cl-http and not about Clozure<span =
class=3D"Apple-converted-space">&nbsp;</span><br class=3D"">Common Lisp, =
perhaps we continue the discussion on the cl-http mailing list.<br =
class=3D""><br class=3D"">For me the key issue is now whether it is a =
good idea to use utf-8<span =
class=3D"Apple-converted-space">&nbsp;</span><br class=3D"">streams for =
a full response header/body.<br class=3D""><br class=3D"">In a private =
mail to us Rainer said that he doubted that - at least I<span =
class=3D"Apple-converted-space">&nbsp;</span><br class=3D"">understood =
it that way - and he probably has good reasons.<br =
class=3D""></blockquote><br style=3D"font-family: Helvetica; font-size: =
14px; font-style: normal; font-variant: normal; font-weight: normal; =
letter-spacing: normal; line-height: normal; orphans: auto; text-align: =
start; text-indent: 0px; text-transform: none; white-space: normal; =
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" =
class=3D""><span style=3D"font-family: Helvetica; font-size: 14px; =
font-style: normal; font-variant: normal; font-weight: normal; =
letter-spacing: normal; line-height: normal; orphans: auto; text-align: =
start; text-indent: 0px; text-transform: none; white-space: normal; =
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: =
none; display: inline !important;" class=3D"">I think Rainer in correct. =
&nbsp;In general, the external format of body depends on</span><br =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px;" class=3D""><span =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px; float: none; display: inline =
!important;" class=3D"">its contents and maybe the request headers, so =
you can't force it to be utf-8</span><br style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px;" class=3D""><span style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; float: none; display: inline =
!important;" class=3D"">when the connection is accepted.</span><br =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px;" class=3D""><br style=3D"font-family:=
 Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px;" class=3D""><span style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; float: none; display: inline =
!important;" class=3D"">__Martin</span><br style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px;" class=3D""><br style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px;" class=3D""><span style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; float: none; display: inline =
!important;" =
class=3D"">_______________________________________________</span><br =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px;" class=3D""><span =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px; float: none; display: inline =
!important;" class=3D"">WWW-CL mailing list</span><br =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px;" class=3D""><a =
href=3D"mailto:[email protected]" style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px;" =
class=3D"">[email protected]</a><br style=3D"font-family: =
Helvetica; font-size: 14px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: auto; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: auto; word-spacing: 0px; =
-webkit-text-stroke-width: 0px;" class=3D""><a =
href=3D"https://lists.csail.mit.edu/mailman/listinfo/www-cl" =
style=3D"font-family: Helvetica; font-size: 14px; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: auto; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; widows: auto; word-spacing: =
0px; -webkit-text-stroke-width: 0px;" =
class=3D"">https://lists.csail.mit.edu/mailman/listinfo/www-cl</a></div></=
div></blockquote></div><br class=3D""></body></html>=

--Apple-Mail=_08B02EED-60C0-4D41-89CE-6AACE411F51F--


--===============8011210642509560547==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
WWW-CL mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/www-cl

--===============8011210642509560547==--