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 2C59A81F1F for ; Thu, 1 Dec 2016 18:07:57 -0800 (PST) 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, 2 Dec 2016 10:07:55 +0800 From: Tim Lewis To: "edk2-devel@lists.01.org" Thread-Topic: Root Cause of Parse Failure With Redirected Input Thread-Index: AdJMP93lD8z77+p2R6Kp8IsqkJvnxw== Date: Fri, 2 Dec 2016 02:07:54 +0000 Message-ID: <7236196A5DF6C040855A6D96F556A53F410BD6@msmail.insydesw.com.tw> Accept-Language: en-US, zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.100.111] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Root Cause of Parse Failure With Redirected Input 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, 02 Dec 2016 02:07:57 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable if (StrStr (TempLine, L"ShellCommand,") =3D=3D TempLine) { LoopVariable++; } This line fails because, with redirected input, the file has the UCS-2 byte= order mark, so the string "ShellCommand," is not at the beginning of the l= ine. With the file, the byte order mark is not present. Why? if (StreamingUnicode) { TempLine =3D ParseReturnStdInLine (FileHandle); } else { TempLine =3D ShellFileHandleReturnLine (FileHandle, &Ascii); } The Shell library function ShellFileHandleReturnLine will strip off the byt= e order mark. But the ParseReturnStdInLine does not. So the first character= on the line is not 'S', it is the byte order mark. Tim