comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: win32 interfacing check (SetClipboardData)
Date: Fri, 1 Sep 2017 15:10:25 +0200
Date: 2017-09-01T15:10:25+02:00	[thread overview]
Message-ID: <oobm80$1ln1$1@gioia.aioe.org> (raw)
In-Reply-To: 59a957e3$0$31612$426a74cc@news.free.fr

On 01/09/2017 14:51, Xavier Petit wrote:
> Thanks but even with Set_Clipboard (Ada.[Wide_]Wide_Text_IO.Get_Line); I 
> was getting weird clipboard text without -gnatW8 flag.

But these are not UTF-8! They are UCS-2 and UCS-4.

([Wide_]Wide_Text_IO should never be used, there is no single case one 
would need these.)

If you have a UTF-8 encoded file (e.g. created using Notepad++, saved 
without BOM), you should use Ada.Streams.Stream_IO, best in binary mode 
if you are using GNAT.

You will have to detect line ends manually, but at least there will be 
guaranty that the run-time does not mangle anything.

If you are using Windows calls with the "W" suffix, then all strings 
there are already UTF-16 and you don't need to convert anything.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2017-09-01 13:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29 20:28 win32 interfacing check (SetClipboardData) Xavier Petit
2017-08-30 16:04 ` Dmitry A. Kazakov
2017-08-30 18:41   ` Xavier Petit
2017-08-30 21:17     ` Dmitry A. Kazakov
2017-09-01 12:51       ` Xavier Petit
2017-09-01 13:10         ` Dmitry A. Kazakov [this message]
2017-09-02  9:38           ` Xavier Petit
2017-09-02 12:29             ` Dmitry A. Kazakov
2017-08-31  1:41   ` Randy Brukardt
2017-09-01 12:53     ` Xavier Petit
replies disabled

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