public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Tim Lewis <tim.lewis@insyde.com>
To: edk2-devel-01 <edk2-devel@lists.01.org>
Subject: AsciiPrint behavior with \n linefeed characters.
Date: Thu, 13 Oct 2016 21:29:29 +0000	[thread overview]
Message-ID: <7236196A5DF6C040855A6D96F556A53F3F67FD@msmail.insydesw.com.tw> (raw)

In using AsciiPrint (I'm presuming the behavior is also in Print, but I haven'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 mystified by their output can understand it.

Consider this example:

CONST CHAR16 *XyzStr = "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 to "BYE" being suspended one character to the right and one row lower than "HI"


             reply	other threads:[~2016-10-13 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13 21:29 Tim Lewis [this message]
2016-10-14  1:24 ` AsciiPrint behavior with \n linefeed characters Gao, Liming
2016-10-14  2:05   ` Tim Lewis
2016-10-14  7:03     ` Joaquin Cono Bolillo
2016-10-14  9:31     ` Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7236196A5DF6C040855A6D96F556A53F3F67FD@msmail.insydesw.com.tw \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox