id summary reporter owner description type status milestone component version severity resolution keywords cc 5644 tellg returns different results for gnu libstd++ and others standard libraries for codecvt_null Michael.Kv@… Robert Ramey "I believe the tellg funtion below shall return the stream position 2 after reading single wide character and it does so for non-gnu standard library. But it returs 1 instead for gnu libstd++ (mingw 4.5.2) though as you may see the wifstream::read call reads two bytes indeed. You may also see that subsequent read operations will be incorrect -- you will get 5bff instead of 005b. You may also want to take http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49269 into consideration. -- Michael Kochetkov {{{ #include #include #include #include int main() { try { std::wifstream is; is.imbue(std::locale(std::locale::classic(), new boost::archive::codecvt_null())); is.exceptions(std::ios::badbit); // Samples.txt shall look in hex like this: // FEFF 005B 0030 0020 ¦ 0020 0020 0031 005D | ?[0 1] is.open(""samples.txt"",std::ios::in | std::ios::binary); unsigned int bom = 0; is.read(reinterpret_cast(&bom),1); const unsigned short bomLE = 0xFEFF; if (bom != bomLE) { throw std::runtime_error(""Invalid BOM. Only LE is supported""); } std::cout << ""Current position: "" << is.tellg() << std::endl; } catch(const std::exception& e) { std::cout << e.what() << std::endl; } } }}} " Bugs closed To Be Determined serialization Boost 1.46.1 Problem wontfix