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 669B41A1E93 for ; Thu, 13 Oct 2016 14:29:32 -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 05:29:30 +0800 From: Tim Lewis To: edk2-devel-01 Thread-Topic: AsciiPrint behavior with \n linefeed characters. Thread-Index: AdIlmEYY+/SVy1wESaaL2W47nkJyGA== Date: Thu, 13 Oct 2016 21:29:29 +0000 Message-ID: <7236196A5DF6C040855A6D96F556A53F3F67FD@msmail.insydesw.com.tw> Accept-Language: en-US, zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.100.108] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: 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: Thu, 13 Oct 2016 21:29:33 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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"