FileReadUTF16LE skips optional BOM and FileWriteUTF16LE can write a BOM with the /BOM switch
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6626 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
37c81f74f8
commit
b54c831ff0
7 changed files with 59 additions and 13 deletions
|
@ -5690,11 +5690,17 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
ERROR_MSG(_T("Error: %") NPRIs _T(" is only available when building a Unicode installer\n"), line.gettoken_str(0));
|
||||
return PS_ERROR;
|
||||
}
|
||||
ent.which=EW_FPUTWS;
|
||||
ent.offsets[0]=GetUserVarIndex(line, 1); // file handle
|
||||
ent.offsets[1]=add_string(line.gettoken_str(2));
|
||||
if (ent.offsets[0]<0) PRINTHELP()
|
||||
SCRIPT_MSG(_T("FileWriteUTF16LE: %") NPRIs _T("->%") NPRIs _T("\n"),line.gettoken_str(2),line.gettoken_str(1));
|
||||
{
|
||||
UINT bom=0, swofs=0;
|
||||
if (!_tcsicmp(_T("/BOM"),line.gettoken_str(swofs+1))) ++bom, ++swofs;
|
||||
if (!_tcsicmp(_T("/NoBOM"),line.gettoken_str(swofs+1))) bom = 0, ++swofs; // Undocumented switch
|
||||
ent.which=EW_FPUTWS;
|
||||
ent.offsets[0]=GetUserVarIndex(line, swofs+1); // file handle
|
||||
ent.offsets[1]=add_string(line.gettoken_str(swofs+2));
|
||||
ent.offsets[3]=bom;
|
||||
if (ent.offsets[0]<0 || line.getnumtokens()-swofs != 3) PRINTHELP()
|
||||
SCRIPT_MSG(_T("FileWriteUTF16LE: %") NPRIs _T("->%") NPRIs _T("\n"),line.gettoken_str(swofs+2),line.gettoken_str(swofs+1));
|
||||
}
|
||||
return add_entry(&ent);
|
||||
case TOK_FILEREADWORD:
|
||||
if (!build_unicode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue