Tim:
  PrintLib only says \n in format string to be converted. It keeps other string 
as-is. So, this is the expected behavior. 

Thanks
Liming
> -----Original Message-----
> From: Tim Lewis [mailto:tim.le...@insyde.com]
> Sent: Friday, October 14, 2016 10:05 AM
> To: Gao, Liming <liming....@intel.com>; edk2-devel-01 <edk2-
> de...@lists.01.org>
> Subject: RE: AsciiPrint behavior with \n linefeed characters.
> 
> Liming --
> 
> And I agree that this should be the behavior. I was surprised by the lack of
> translation for the other string printed via %s.
> 
> Tim
> 
> -----Original Message-----
> From: Gao, Liming [mailto:liming....@intel.com]
> Sent: Thursday, October 13, 2016 6:24 PM
> To: Tim Lewis <tim.le...@insyde.com>; edk2-devel-01 <edk2-
> de...@lists.01.org>
> 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.
> 
> 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'
> 
> Thanks
> Liming
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Tim Lewis
> Sent: Friday, October 14, 2016 5:29 AM
> To: edk2-devel-01 <edk2-devel@lists.01.org>
> Subject: [edk2] AsciiPrint behavior with \n linefeed characters.
> 
> 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"
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to