From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from msmail.insydesw.com.tw (ms.insydesw.com [211.75.113.220]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EBE841A1EC3 for ; Thu, 13 Oct 2016 19:05:24 -0700 (PDT) Received: from msmail.insydesw.com.tw ([fe80::74f7:f173:f4aa:9a05]) by msmail.insydesw.com.tw ([fe80::74f7:f173:f4aa:9a05%11]) with mapi id 14.01.0438.000; Fri, 14 Oct 2016 10:05:22 +0800 From: Tim Lewis To: "Gao, Liming" , edk2-devel-01 Thread-Topic: AsciiPrint behavior with \n linefeed characters. Thread-Index: AdIlmEYY+/SVy1wESaaL2W47nkJyGAAIQtnAAAF5YxA= Date: Fri, 14 Oct 2016 02:05:22 +0000 Message-ID: <7236196A5DF6C040855A6D96F556A53F3F6968@msmail.insydesw.com.tw> References: <7236196A5DF6C040855A6D96F556A53F3F67FD@msmail.insydesw.com.tw> <4A89E2EF3DFEDB4C8BFDE51014F606A14B492FE6@shsmsx102.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14B492FE6@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US, zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [73.48.186.173] 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 02:05:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Liming -- And I agree that this should be the behavior. I was surprised by the lack o= f translation for the other string printed via %s. Tim -----Original Message----- From: Gao, Liming [mailto:liming.gao@intel.com]=20 Sent: Thursday, October 13, 2016 6:24 PM To: Tim Lewis ; edk2-devel-01 Subject: RE: AsciiPrint behavior with \n linefeed characters. 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