time_get is not reading time_put weekdays output for French locale

Latest response

time_get is not reading time_put weekdays output for French locale.  This issue occurs on both Red hat 5 and 6.

 

$>cat t.cpp && g++ -v && uname -srm && g++ t.cpp && ./a.out
#include <iostream>
#include <sstream>
#include <locale>
using namespace std;

int main ()
{
  locale loc("fr_FR");
  ostringstream os;
  os.imbue (loc);

  const time_put<char>& tmput = use_facet <time_put<char> > (loc);
  tm t;
  t.tm_wday = 2;

  tmput.put (os, os, ' ', &t, 'A');
  cout << os.str() << endl;

  t.tm_wday = 0;

  istringstream is(os.str());
  is.imbue (loc);
  const time_get<char>& tmget = use_facet <time_get<char> > (loc);
  ios::iostate state;
  istreambuf_iterator<char> itbegin (is);
  istreambuf_iterator<char> itend;

  tmget.get_weekday (itbegin, itend, is, state, &t);

  cout << "weekday: " << t.tm_wday << endl;
  return 0;
}
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC)
Linux 2.6.32-131.0.15.el6.x86_64 x86_64
mardi
weekday: 0
 

Responses