diff --git a/testEncoding.cxx b/testEncoding.cxx index 2c5ef46eb96a7cd7b6eaa68c497a1f0f6e3adde4..2742fe4533e3fe8fb411cfe471fd239cfa8d8ff8 100644 --- a/testEncoding.cxx +++ b/testEncoding.cxx @@ -75,6 +75,10 @@ static int testRobustEncoding() // test that the conversion functions handle invalid // unicode correctly/gracefully + // we manipulate the format flags of stdout, remember + // the original state here to restore before return + std::ios::fmtflags const& flags = std::cout.flags(); + int ret = 0; char cstr[] = { (char)-1, 0 }; // this conversion could fail @@ -120,6 +124,7 @@ static int testRobustEncoding() ret++; } + std::cout.flags(flags); return ret; }