[Bug libstdc++/12868] New: basic_filebuf::imbue fails too easily

peturr02 at ru dot is gcc-bugzilla@gcc.gnu.org
Sat Nov 1 08:14:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12868

           Summary: basic_filebuf::imbue fails too easily
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peturr02 at ru dot is
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

If basic_filebuf::imbue() is called after a file has been opened, it only
changes the locale if seekoff(0, cur) returns 0. There are two problems with
this:

1) For regular files, the locale can only be changed at the beginning of the
file. This can be a problem for files such as XML files, in which the
encoding is stored in the file itself.

2) For pipes, ttys etc. there is no way to change locale. This is especially
a problem for wcin, wcout, wcerr and wclog, where the only way to set the
locale is to set the global locale before calling sync_with_stdio(false).



More information about the Gcc-bugs mailing list