Basic UTF-8 support in ansi build so it can read UTF-8 .nlf files and LangStrings
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6196 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
359ad0a055
commit
ef8a83bd41
10 changed files with 227 additions and 5 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <cassert> // for assert(3)
|
||||
#include <time.h>
|
||||
#include "tstring.h"
|
||||
#include "utf.h"
|
||||
#include <algorithm>
|
||||
#include "boost/scoped_ptr.hpp"
|
||||
|
||||
|
@ -813,6 +814,10 @@ int CEXEBuild::includeScript(TCHAR *f)
|
|||
return PS_ERROR;
|
||||
}
|
||||
build_include_depth++;
|
||||
#ifndef _UNICODE
|
||||
const bool org_build_include_isutf8 = build_include_isutf8;
|
||||
build_include_isutf8 = IsUTF8BOM(incfp);
|
||||
#endif
|
||||
|
||||
int last_linecnt=linecnt;
|
||||
linecnt=0;
|
||||
|
@ -837,6 +842,10 @@ int CEXEBuild::includeScript(TCHAR *f)
|
|||
restore_timestamp_predefine(oldtimestamp);
|
||||
#endif
|
||||
|
||||
#ifndef _UNICODE
|
||||
build_include_isutf8 = org_build_include_isutf8;
|
||||
#endif
|
||||
|
||||
int errlinecnt=linecnt;
|
||||
|
||||
linecnt=last_linecnt;
|
||||
|
@ -1712,13 +1721,21 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
TCHAR *name = line.gettoken_str(1);
|
||||
LANGID lang = line.gettoken_int(2);
|
||||
TCHAR *str = line.gettoken_str(3);
|
||||
int ret = SetLangString(name, lang, str, curfile_unicode);
|
||||
int ret;
|
||||
#ifndef _UNICODE
|
||||
if (build_include_isutf8)
|
||||
ret = SetUTF8LangString(name, lang, str);
|
||||
else
|
||||
#endif
|
||||
ret = SetLangString(name, lang, str, curfile_unicode);
|
||||
|
||||
if (ret == PS_WARNING)
|
||||
warning_fl(_T("LangString \"%s\" set multiple times for %d, wasting space"), name, lang);
|
||||
else if (ret == PS_ERROR) {
|
||||
ERROR_MSG(_T("Error: can't set LangString \"%s\"!\n"), name);
|
||||
return PS_ERROR;
|
||||
}
|
||||
// BUGBUG: Does not display UTF-8 properly.
|
||||
SCRIPT_MSG(_T("LangString: \"%s\" %d \"%s\"\n"), name, lang, str);
|
||||
}
|
||||
return PS_OK;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue