From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: win32 interfacing check (SetClipboardData) Date: Fri, 1 Sep 2017 15:10:25 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <59a5ce50$0$7168$426a74cc@news.free.fr> <59a706d2$0$3723$426a74cc@news.free.fr> <59a957e3$0$31612$426a74cc@news.free.fr> NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:47876 Date: 2017-09-01T15:10:25+02:00 List-Id: 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