From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.lisp.guile.user Subject: Re: http-client port encoding failed Date: Sat, 5 Sep 2020 10:55:52 +0200 Message-ID: <20200905085552.GA12516@tuxteam.de> References: <20200904143545.Horde.ifPsqyXMMJ1PsdBw6X4d2Fh@www.stihie.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YZ5djTAD1cGYuMQK" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3477"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Sep 05 10:56:55 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kEU0E-0000lZ-15 for guile-user@m.gmane-mx.org; Sat, 05 Sep 2020 10:56:54 +0200 Original-Received: from localhost ([::1]:43578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEU0C-0006bl-V9 for guile-user@m.gmane-mx.org; Sat, 05 Sep 2020 04:56:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEU02-0006ba-Qr for guile-user@gnu.org; Sat, 05 Sep 2020 04:56:42 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:42902) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1kEU00-0002MC-M9 for guile-user@gnu.org; Sat, 05 Sep 2020 04:56:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=U4gUaNH175KVWMaEkxFr+KoNu7rqfpaxL/kGZuvern4=; b=hY/RsONg3TC0R/r5PXMRglKpYYKau2CmohCwYKnBMOakZsUsIqpi0nrs5nwy3Vlzs7YZm8XbJjqfkyT4sWVs6koKiO3qUilqoTz70/VDq7H66Le0SXzS8er1jw2FYlPRIaElA5I/5V2FSmvK4SGgRWpkj3tHbVw7AXsRL/RmHA4U1ReG+dsGey8+BVv1ueliKHNBeBH9Kl6RwZhpJRAk0AkUjm+nz4G7/nKb4SZ2WrooCIwSmXDVMm+qww5ie3gbbMiwWpTdJswKeCmP067gU7WHXCOo6mPGaxWX9XDIYC5mYcvvbQEHHzJcee0DJoveTpM8TrBVKRM+Fs4+gVSGJg==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1kETzT-00045h-Tm for guile-user@gnu.org; Sat, 05 Sep 2020 10:56:07 +0200 Content-Disposition: inline In-Reply-To: <20200904143545.Horde.ifPsqyXMMJ1PsdBw6X4d2Fh@www.stihie.net> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/05 04:56:27 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:16859 Archived-At: --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 04, 2020 at 02:35:45PM -0500, mbcladwell@stihie.net wrote: >=20 > Hi, >=20 > I am using http-client to submit requests that contain extended > Latin characters e.g. "Marjanovi=C4=87+=C5=BD". 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. >=20 > scheme@(guile-user)> (locale-encoding) > $11 =3D "UTF-8" >=20 > When I submit a url containing the above Serbian name, I get the error: >=20 > Throw to key `encoding-error' with args `("put-char" "conversion to > port encoding failed" 84 # #\=C4=87)'. I'm not sure and can't double-check at the moment, but: the HTTP header part (and the URL is part of it) /must/ be 7 bit ASCII. That's why there is that URL encoding [1] -- basically you take the UTF-8 encoded string and represent every byte (octet) beyond 0x7f (and some "hot" bytes beneath that) by %, where is the hexadecimal representation of that byte. Perhaps you have to URL-encode your URL before "submitting" it. > If I paste the URL into my browser I receive the correct response. Your browser does all of the above for you. It just doesn't tell you :) > Prior to the request I use (set-port-encoding! (current-output-port) > "UTF-8") without effect. Hm. I don't know what the "right" encoding for a HTTP connection is. But the HTTP header part is 7 biz ASCII (which is a subset of UTF-8, but just that :) The quintessence is: try url-encoding your URL. Cheers - t --YZ5djTAD1cGYuMQK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl9TUpgACgkQBcgs9XrR2kb0wgCePwbpYtHOybwSF0dOZMS8I27m UjEAni3xQs6KXdIdZXxkot/2UCGOJBsM =oopM -----END PGP SIGNATURE----- --YZ5djTAD1cGYuMQK--