unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* http-client port encoding failed
@ 2020-09-04 19:35 mbcladwell
  2020-09-05  8:55 ` tomas
  0 siblings, 1 reply; 4+ messages in thread
From: mbcladwell @ 2020-09-04 19:35 UTC (permalink / raw)
  To: guile-user


Hi,

I am using http-client to submit requests that contain extended Latin  
characters e.g. "Marjanović+Ž".  I believe I have locales set up  
properly as I don't receive the "can't set locales" error.  Also I can  
regex with the extended Latin characters.

scheme@(guile-user)> (locale-encoding)
$11 = "UTF-8"

  When I submit a url containing the above Serbian name, I get the error:

Throw to key `encoding-error' with args `("put-char" "conversion to  
port encoding failed" 84 #<input-output: string 7febcf44c2a0> #\ć)'.

If I paste the URL into my browser I receive the correct response.

Prior to the request I use (set-port-encoding! (current-output-port)  
"UTF-8") without effect.
What should I do?
Thanks
Mortimer






^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: http-client port encoding failed
@ 2020-09-08 14:26 mbcladwell
  2020-09-08 14:33 ` tomas
  0 siblings, 1 reply; 4+ messages in thread
From: mbcladwell @ 2020-09-08 14:26 UTC (permalink / raw)
  To: tomas, guile-user


Not sure I am doing exactly what you suggest but the following (based  
on your suggestion) seems to work:

(define auth "Marjanović+Ž")
(http-request (string-append "https://......&term=" auth  
"[auth]&retmax=20")) ===> error!!
Throw to key `encoding-error' with args `("put-char" "conversion to  
port encoding failed" 84 #<input-output: string 7f9a247d75b0> #\ć)'.

(define authencode (uri-encode "Marjanović+Ž")) ===>  
"Marjanovi%C4%87%2B%C5%BD"
(http-request (string-append "https://....&term=" authencode  
"[auth]&retmax=20"))  ===>success!!

Thanks
Mortimer






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-08 14:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 19:35 http-client port encoding failed mbcladwell
2020-09-05  8:55 ` tomas
  -- strict thread matches above, loose matches on Subject: below --
2020-09-08 14:26 mbcladwell
2020-09-08 14:33 ` tomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).