comp.lang.ada
 help / color / mirror / Atom feed
From: Vadim Godunko <vgodunko@gmail.com>
Subject: Re: windows-1251 to utf-8
Date: Thu, 1 Nov 2018 11:14:34 -0700 (PDT)
Date: 2018-11-01T11:14:34-07:00	[thread overview]
Message-ID: <14e30503-2519-4af0-9c22-d1cd8d9ded65@googlegroups.com> (raw)
In-Reply-To: <74537c7a-18dd-421a-b3c2-6919285006cd@googlegroups.com>

You can use Matreshka's text codecs, here is example.

with Ada.Text_IO;        use Ada.Text_IO;

with AWS.Client;         use AWS.Client;
with AWS.Response;       use AWS.Response;

with League.Strings;     use League.Strings;
with League.Text_Codecs; use League.Text_Codecs;

procedure Main is
   Request_Header_List : Header_List;
   CP1251_Codec        : Text_Codec := Codec (To_Universal_String ("cp1251"));
   Text                : Universal_String;

begin

   Request_Header_List.Add(Name => "User-Agent", Value => "Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0");

   Text := CP1251_Codec.Decode (Message_Body(Get(URL => "http://www.sql.ru/", Headers => Request_Header_List)));

   Put_Line(Text.To_UTF_8_String);

end Main;

      parent reply	other threads:[~2018-11-01 18:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31  2:57 windows-1251 to utf-8 eduardsapotski
2018-10-31  6:09 ` gautier_niouzes
2018-10-31 10:01 ` Dmitry A. Kazakov
2018-10-31 15:28 ` eduardsapotski
2018-10-31 16:50   ` Shark8
2018-10-31 17:01   ` Dmitry A. Kazakov
2018-10-31 20:58     ` Randy Brukardt
2018-11-01 12:49   ` Björn Lundin
2018-11-01 13:26     ` Dmitry A. Kazakov
2018-11-01 14:34       ` Björn Lundin
2018-11-01 18:14 ` Vadim Godunko [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox