From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4100D1A1E8B for ; Thu, 13 Oct 2016 18:25:36 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 13 Oct 2016 18:25:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,491,1473145200"; d="scan'208";a="889844395" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 13 Oct 2016 18:25:35 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 13 Oct 2016 18:25:34 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 13 Oct 2016 18:24:32 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.104]) with mapi id 14.03.0248.002; Fri, 14 Oct 2016 09:24:30 +0800 From: "Gao, Liming" To: Tim Lewis , edk2-devel-01 Thread-Topic: AsciiPrint behavior with \n linefeed characters. Thread-Index: AdIlmEYY+/SVy1wESaaL2W47nkJyGAAIQtnA Date: Fri, 14 Oct 2016 01:24:29 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14B492FE6@shsmsx102.ccr.corp.intel.com> References: <7236196A5DF6C040855A6D96F556A53F3F67FD@msmail.insydesw.com.tw> In-Reply-To: <7236196A5DF6C040855A6D96F556A53F3F67FD@msmail.insydesw.com.tw> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjc4ZGZhZmMtMDM1Yi00ZjNlLTgyZGQtYTkwN2EzNGE3MGExIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjF3VkFPMDkzK0RmTkV6OENVRUhNWGZlTkRSd21sZ3VkSTRwMUNlbTRmem89In0= x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: AsciiPrint behavior with \n linefeed characters. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 01:25:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Tim: The first parameter in AsciiPrint() is the Format string. Per PrintLib.h = definition, \n will be changed to \r\n in the format string.=20 The following end of line(EOL) translations must be performed on the conten= ts of the format string: - '\\r' is translated to '\\r' - '\\r\\n' is translated to '\\r\\n' - '\\n' is translated to '\\r\\n'=20 - '\\n\\r' is translated to '\\r\\n' Thanks Liming -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Tim = Lewis Sent: Friday, October 14, 2016 5:29 AM To: edk2-devel-01 Subject: [edk2] AsciiPrint behavior with \n linefeed characters. In using AsciiPrint (I'm presuming the behavior is also in Print, but I hav= en't tested), I found an interesting behavior for linefeed characters embed= ded in strings that are parameters. I post it here just so people who are m= ystified by their output can understand it. Consider this example: CONST CHAR16 *XyzStr =3D "HI\nBYE"; AsciiPrint(XyzStr); AsciiPrint("Offset\n%s\n", XyzStr); Output looks like this: HI BYE Offset HI BYE It turns out that \n characters in the format string are converted to \r\n,= but \n characters in strings that are embedded (as in the second example) = are not converted. So only the linefeed character is interpreted, leading t= o "BYE" being suspended one character to the right and one row lower than "= HI" _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel