From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id ED7F91A1ED5 for ; Fri, 14 Oct 2016 02:33:00 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP; 14 Oct 2016 02:33:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,344,1473145200"; d="scan'208";a="19598474" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 14 Oct 2016 02:33:00 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 14 Oct 2016 02:33:00 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 14 Oct 2016 02:31:57 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.139]) with mapi id 14.03.0248.002; Fri, 14 Oct 2016 17:31:55 +0800 From: "Gao, Liming" To: Tim Lewis , edk2-devel-01 Thread-Topic: AsciiPrint behavior with \n linefeed characters. Thread-Index: AdIlmEYY+/SVy1wESaaL2W47nkJyGAAIQtnAAAF5YxAAD5KzYA== Date: Fri, 14 Oct 2016 09:31:54 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14B4932A0@shsmsx102.ccr.corp.intel.com> References: <7236196A5DF6C040855A6D96F556A53F3F67FD@msmail.insydesw.com.tw> <4A89E2EF3DFEDB4C8BFDE51014F606A14B492FE6@shsmsx102.ccr.corp.intel.com> <7236196A5DF6C040855A6D96F556A53F3F6968@msmail.insydesw.com.tw> In-Reply-To: <7236196A5DF6C040855A6D96F556A53F3F6968@msmail.insydesw.com.tw> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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 09:33:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Tim: PrintLib only says \n in format string to be converted. It keeps other st= ring as-is. So, this is the expected behavior.=20 Thanks Liming > -----Original Message----- > From: Tim Lewis [mailto:tim.lewis@insyde.com] > Sent: Friday, October 14, 2016 10:05 AM > To: Gao, Liming ; edk2-devel-01 devel@lists.01.org> > Subject: RE: AsciiPrint behavior with \n linefeed characters. >=20 > Liming -- >=20 > And I agree that this should be the behavior. I was surprised by the lack= of > translation for the other string printed via %s. >=20 > Tim >=20 > -----Original Message----- > From: Gao, Liming [mailto:liming.gao@intel.com] > Sent: Thursday, October 13, 2016 6:24 PM > To: Tim Lewis ; edk2-devel-01 devel@lists.01.org> > Subject: RE: AsciiPrint behavior with \n linefeed characters. >=20 > 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 > contents of the format string: > - '\\r' is translated to '\\r' > - '\\r\\n' is translated to '\\r\\n' > - '\\n' is translated to '\\r\\n' > - '\\n\\r' is translated to '\\r\\n' >=20 > 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. >=20 > In using AsciiPrint (I'm presuming the behavior is also in Print, but I h= aven't > tested), I found an interesting behavior for linefeed characters embedded= in > strings that are parameters. I post it here just so people who are mystif= ied by > their output can understand it. >=20 > Consider this example: >=20 > CONST CHAR16 *XyzStr =3D "HI\nBYE"; >=20 > AsciiPrint(XyzStr); > AsciiPrint("Offset\n%s\n", XyzStr); >=20 > Output looks like this: >=20 > HI > BYE > Offset > HI > BYE >=20 > 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 to = "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