This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
With the environment locale set to UTF-8, I get the expected exception: terminate called after throwing an instance of 'std::ios_base::failure' what(): basic_filebuf::underflow incomplete character in file
#include <locale> #include <iostream> #include <fstream> #include <string> #include <iterator>
int main()
{
setlocale(LC_ALL, ""); std::ofstream f("/tmp/8859");
f << "\xe3" << std::flush;
f.close(); for (wchar_t wc:w)
{
if ((wc & 0x7f) == wc)
std::cout << (char)wc;
else
std::cout << "[" << (int)wc << "]";
}
return 0;
}Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |