Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tcllib's rest package bug...

107 views
Skip to first unread message

Georgios Petasis

unread,
Aug 7, 2015, 4:14:24 AM8/7/15
to
Hi all,

I tried to use the rest package from tcllib, and I think it has a bug
(it cannot handle encodings, I haven't found a way to pass utf-8 json
correctly).

But I am not sure where I can submit a bug.

(Not important, "http::geturl $url -query $json \
-method PUT -binary 1 \
-type application/json\;charset=utf-8"
solved my problem)

George

Georgios Petasis

unread,
Aug 7, 2015, 5:11:03 AM8/7/15
to
Hm, this needs more research. The above call has not solved my problem...

George

Georgios Petasis

unread,
Aug 7, 2015, 5:41:11 AM8/7/15
to
However, this works:

http::geturl $url \
-query [encoding convertto identity $json] \
-method PUT -binary 1 \
-type "application/json;charset=utf-8"

It seems that the key is "encoding convertto identity". I am not sure
why it is needed...
And I suspect the solution to tcllib's rest package is the same...

George

Alexandre Ferrieux

unread,
Aug 7, 2015, 6:36:07 AM8/7/15
to
Identity is an internal wart, to be avoided as much as possible.
Can you give details on how you set $json ?

If it were a full-fledged Tcl string, [encoding convertto utf-8] would be the way to go.
If it were a byte array extracted by [read] from a binary-configured channel which happens to carry UTF-8-encoded characters, no conversion at all would be needed (since the socket in [http::geturl] is also binary-configured at the time it carries the body).

Maybe you're in a third case ?

-Alex

Georgios Petasis

unread,
Aug 11, 2015, 4:15:35 AM8/11/15
to
Dear Alex,

I think I am in the first case, it was created from tcllib's huddle
package. I didn't thought about "convertto utf-8" at all. I thought it
was already utf-8 :-)

Regards,

George

Andreas Kupries

unread,
Oct 10, 2015, 4:08:28 AM10/10/15
to
Georgios Petasis <pet...@iit.demokritos.gr> writes:

> On 7/8/2015 13:36, Alexandre Ferrieux wrote:
>> On Friday, August 7, 2015 at 11:41:11 AM UTC+2, Georgios Petasis wrote:
>>> On 7/8/2015 12:11, Georgios Petasis wrote:
>>>> On 7/8/2015 11:14, Georgios Petasis wrote:
>>>>> Hi all,
>>>>>
>>>>> I tried to use the rest package from tcllib, and I think it has a bug
>>>>> (it cannot handle encodings, I haven't found a way to pass utf-8 json
>>>>> correctly).
>>>>>
>>>>> But I am not sure where I can submit a bug.

As a Tcllib package you can submit bugs with Tcllib, at

http://core.tcl.tk/tcllib/

also, if you are using teacup. look at the output of

teacup describe --all rest

Or filter down to the relevant piece with

teacup describe --all rest|grep -i origin

I tried very hard to associate each package in the TEApot with a
suitable origin location.


--
So long,
Andreas Kupries <akup...@shaw.ca>
<http://core.tcl.tk/akupries/>
Developer @ HP Enterprise

Tcl'2015, Oct 19-23, Manassas, VA, USA, http://www.tcl.tk/community/tcl2015/
-------------------------------------------------------------------------------
0 new messages