comp.lang.ada
 help / color / mirror / Atom feed
From: "Björn Lundin" <b.f.lundin@gmail.com>
Subject: Re: windows-1251 to utf-8
Date: Thu, 1 Nov 2018 15:34:28 +0100
Date: 2018-11-01T15:34:28+01:00	[thread overview]
Message-ID: <prf377$u06$1@dont-email.me> (raw)
In-Reply-To: <preuue$1g2$1@gioia.aioe.org>

On 2018-11-01 14:26, Dmitry A. Kazakov wrote:
> On 2018-11-01 13:49, Björn Lundin wrote:
> 
>> something like (with changes for 1251 instead of Latin_1 to be done)
> 
> You probably mean 1252 which almost Latin-1. 

I do.


> 1251 is totally different.
> it has Cyrillic letters in the upper half of 8-bit codes, in the place
> where 1252 keeps Central European letters with fancy diacritic marks.

And I also found that the code in last post can be replaced by

  -------------------------------------------------------
  function To_Iso_Latin_15(Str : Unicode.CES.Byte_Sequence) return String is
    use Unicode.Encodings;
  begin
    return  Convert(Str  => Str,
                    From => Get_By_Name("utf-8"),
                    To   => Get_By_Name("iso-8859-15"));

  end To_Iso_Latin_15;
  -------------------------------------------------------

I also see that the unicode package in xml/ada has support for
1251 and 1252.

package Unicode.CCS.Windows_1251 is ...

the withs are
with Ada.Exceptions;                   use Ada.Exceptions;
with Unicode.Names.Cyrillic;           use Unicode.Names.Cyrillic;
with Unicode.Names.Basic_Latin;        use Unicode.Names.Basic_Latin;
with Unicode.Names.Latin_1_Supplement; use Unicode.Names.Latin_1_Supplement;
with Unicode.Names.Currency_Symbols;   use Unicode.Names.Currency_Symbols;
with Unicode.Names.General_Punctuation;
use Unicode.Names.General_Punctuation;
with Unicode.Names.Letterlike_Symbols;
use Unicode.Names.Letterlike_Symbols;



which suggests to me that it is the cyrillic one


which (I think) would make the function above


-------------------------------------------------------
  function To_Windows_1251(Str : Unicode.CES.Byte_Sequence) return String is
    use Unicode.Encodings;
  begin
    return  Convert(Str  => Str,
                    From => Get_By_Name("utf-8"),
                    To   => Get_By_Name("Windows-1251"));

  end To_Windows_1251;
  -------------------------------------------------------



-- 
--
Björn

  reply	other threads:[~2018-11-01 14:34 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 [this message]
2018-11-01 18:14 ` Vadim Godunko
replies disabled

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