{"id":811421,"url":"http://patchwork.ozlabs.org/api/1.2/patches/811421/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20170908093903.GA41933@adacore.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170908093903.GA41933@adacore.com>","list_archive_url":null,"date":"2017-09-08T09:39:03","name":"[Ada] PR ada/80888 Text_IO encoding should match source encoding","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bf11499178671004823a6cab9d2b116e707ea914","submitter":{"id":4418,"url":"http://patchwork.ozlabs.org/api/1.2/people/4418/?format=json","name":"Arnaud Charlet","email":"charlet@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20170908093903.GA41933@adacore.com/mbox/","series":[{"id":2155,"url":"http://patchwork.ozlabs.org/api/1.2/series/2155/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=2155","date":"2017-09-08T09:39:03","name":"[Ada] PR ada/80888 Text_IO encoding should match source encoding","version":1,"mbox":"http://patchwork.ozlabs.org/series/2155/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811421/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811421/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461710-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461710-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"bRa9/XnM\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpXMq5Yx4z9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 19:39:18 +1000 (AEST)","(qmail 39536 invoked by alias); 8 Sep 2017 09:39:10 -0000","(qmail 39202 invoked by uid 89); 8 Sep 2017 09:39:09 -0000","from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 08 Sep 2017 09:39:04 +0000","from localhost (localhost.localdomain [127.0.0.1])\tby\n\tfiltered-rock.gnat.com (Postfix) with ESMTP id 59F875619D;\n\tFri,  8 Sep 2017 05:39:03 -0400 (EDT)","from rock.gnat.com ([127.0.0.1])\tby localhost (rock.gnat.com\n\t[127.0.0.1]) (amavisd-new, port 10024)\twith LMTP id\n\t2eQvTKD2YL9w; Fri,  8 Sep 2017 05:39:03 -0400 (EDT)","from tron.gnat.com (tron.gnat.com\n\t[IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294])\tby rock.gnat.com\n\t(Postfix) with ESMTP id 45FB756126;\n\tFri,  8 Sep 2017 05:39:03 -0400 (EDT)","by tron.gnat.com (Postfix, from userid 4192)\tid 4247C505;\n\tFri,  8 Sep 2017 05:39:03 -0400 (EDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type\n\t:content-transfer-encoding; q=dns; s=default; b=Ob4pJQZKo7/nFT9/\n\tSc3YBE08i4i7n5Qyy50+uTi2U4+37QfENQWs7CQ+cMW6IJveblTvgPCd8V3Kqj/p\n\twGjD8OTRr7MG6VlI/hBGs+ftZD96EQwaQ2MhxB0daWnpsX9nE2zju/xw/lfP4mhp\n\tNgfZuzZr3YvjGvdmieHlY6AOmP4=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type\n\t:content-transfer-encoding; s=default; bh=pXEFT1t4Ff1p0ynoRCEfY2\n\tEofn4=; b=bRa9/XnMykuOcXw7pCMC++svw2L5Q86Zrrk5mbzIjTG27VIHI47oCZ\n\t/8Zg7MxPrYcTB2Ew4EpDIZEKBhRmHEXNBoN3UNTyAM+f28MqiXG78FtxV39EfC+x\n\tAAwM934m5O8bqEP779b/N7ZCh2Bx4YFt39XKrfi3KtZQb3I8o3UIA=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2\n\tspammy=HContent-Transfer-Encoding:8bit","X-HELO":"rock.gnat.com","Date":"Fri, 8 Sep 2017 05:39:03 -0400","From":"Arnaud Charlet <charlet@adacore.com>","To":"gcc-patches@gcc.gnu.org","Cc":"Bob Duff <duff@adacore.com>","Subject":"[Ada] PR ada/80888 Text_IO encoding should match source encoding","Message-ID":"<20170908093903.GA41933@adacore.com>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"mYCpIKhGyMATD0i+\"","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","User-Agent":"Mutt/1.5.23 (2014-03-12)"},"content":"The wide character encoding used for Text_IO files is\nsupposed to match the encoding of the source files, as specified by\nthe -gnatW switch, unless it is specified explicitly in the Form\nstring. Instead it incorrectly defaults to brackets encoding. The same\napplies to Wide_Text_IO and Wide_Wide_Text_IO.\n\nThis already worked properly for standard output. This patch fixes the\nproblem for files opened by Text_IO.Create and Text_IO.Open.\n\nWhen compiled without -gnatW, the following test should send Latin-1\ntext to standard output and to log1, and UTF-8 text to log2. With\n-gnatW8, it should use UTF-8 for all three.\n\nwith Ada.Text_IO; use Ada.Text_IO;\nprocedure encode_text_io is\n   file1 : File_Type;\n   file2 : File_Type;\nbegin\n   Put (Character'Val (16#A1#));\n   Create (file1, Out_File, \"log1\");\n   Put (file1, Character'Val (16#A1#));\n   Create (file2, Out_File, \"log2\", Form=>\"WCEM=8\");\n   Put (file2, Character'Val (16#A1#));\n   Close (file1);\n   Close (file2);\nend;\n\nUTF-8 encoding is:\n\nÂ¡\n\nTested on x86_64-pc-linux-gnu, committed on trunk\n\n2017-09-08  Bob Duff  <duff@adacore.com>\n\nPR ada/80888\n\t* a-textio.adb, a-witeio.adb, a-ztexio.adb (Set_WCEM): Use\n\tDefault_WCEM by default (i.e. if the encoding is not specified\n\tby the Form string).","diff":"Index: a-ztexio.adb\n===================================================================\n--- a-ztexio.adb\t(revision 251863)\n+++ a-ztexio.adb\t(working copy)\n@@ -6,7 +6,7 @@\n --                                                                          --\n --                                 B o d y                                  --\n --                                                                          --\n---          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --\n+--          Copyright (C) 1992-2017, Free Software Foundation, Inc.         --\n --                                                                          --\n -- GNAT is free software;  you can  redistribute it  and/or modify it under --\n -- terms of the  GNU General Public License as published  by the Free Soft- --\n@@ -1626,11 +1626,10 @@\n       Stop  : Natural;\n \n    begin\n-      File.WC_Method := WCEM_Brackets;\n       FIO.Form_Parameter (File.Form.all, \"wcem\", Start, Stop);\n \n       if Start = 0 then\n-         File.WC_Method := WCEM_Brackets;\n+         File.WC_Method := Default_WCEM;\n \n       else\n          if Stop = Start then\nIndex: a-textio.adb\n===================================================================\n--- a-textio.adb\t(revision 251863)\n+++ a-textio.adb\t(working copy)\n@@ -6,7 +6,7 @@\n --                                                                          --\n --                                 B o d y                                  --\n --                                                                          --\n---          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --\n+--          Copyright (C) 1992-2017, Free Software Foundation, Inc.         --\n --                                                                          --\n -- GNAT is free software;  you can  redistribute it  and/or modify it under --\n -- terms of the  GNU General Public License as published  by the Free Soft- --\n@@ -1810,11 +1810,10 @@\n       Stop  : Natural;\n \n    begin\n-      File.WC_Method := WCEM_Brackets;\n       FIO.Form_Parameter (File.Form.all, \"wcem\", Start, Stop);\n \n       if Start = 0 then\n-         File.WC_Method := WCEM_Brackets;\n+         File.WC_Method := Default_WCEM;\n \n       else\n          if Stop = Start then\nIndex: a-witeio.adb\n===================================================================\n--- a-witeio.adb\t(revision 251863)\n+++ a-witeio.adb\t(working copy)\n@@ -6,7 +6,7 @@\n --                                                                          --\n --                                 B o d y                                  --\n --                                                                          --\n---          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --\n+--          Copyright (C) 1992-2017, Free Software Foundation, Inc.         --\n --                                                                          --\n -- GNAT is free software;  you can  redistribute it  and/or modify it under --\n -- terms of the  GNU General Public License as published  by the Free Soft- --\n@@ -1652,11 +1652,10 @@\n       Stop  : Natural;\n \n    begin\n-      File.WC_Method := WCEM_Brackets;\n       FIO.Form_Parameter (File.Form.all, \"wcem\", Start, Stop);\n \n       if Start = 0 then\n-         File.WC_Method := WCEM_Brackets;\n+         File.WC_Method := Default_WCEM;\n \n       else\n          if Stop = Start then\n","prefixes":["Ada"]}