add utf-8 check, substitution, and warning to Input::parse() function
This commit is contained in:
@ -106,6 +106,7 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp)
|
||||
label_active = 0;
|
||||
labelstr = nullptr;
|
||||
jump_skip = 0;
|
||||
utf8_warn = true;
|
||||
|
||||
if (me == 0) {
|
||||
nfile = 1;
|
||||
@ -421,6 +422,16 @@ void Input::parse()
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (utils::has_utf8(copy)) {
|
||||
std::string buf = utils::utf8_subst(copy);
|
||||
strcpy(copy,buf.c_str());
|
||||
if (utf8_warn && (comm->me == 0))
|
||||
error->warning(FLERR,"Detected non-ASCII characters in input. "
|
||||
"Will try to continue by replacing with ASCII "
|
||||
"equivalents where known.");
|
||||
utf8_warn = false;
|
||||
}
|
||||
|
||||
// perform $ variable substitution (print changes)
|
||||
// except if searching for a label since earlier variable may not be defined
|
||||
|
||||
|
||||
Reference in New Issue
Block a user