the mail archive of the peturr02 at ru dot is peturr02 at ru dot is Follow-Ups [


Date Prev [ Thread Next ] Thread Prev To Date Index Date Author Index ]
Index Nav: ] [ Message Nav: From: Index Nav: [ ] [ Thread Prev From: Thread Index :
Date Next [ From: [

[Bug libstdc++/14623] UTF-8 encoding, wcout vs. file


 (int x=0; x<i*4+1; x++)      printf("%02hx ", ptr[x]);   printf("\n===\n%s%ls===\n", src, dst);    wofstream myfile;   myfile.imbue(locale());   myfile.open("log.log");    perror("0");   wcout  << L"Testi " << endl << dst << endl;   perror("1");   errno=0;   myfile << L"Rivi 1 " << endl << dst << endl;   perror("2");    myfile.close(); }   On FC1, I"m getting: ----------------start en_US.UTF-8 >21< 1024 54 00 00 00 e4 00 00 00 6d 00 00 00 e4 00 00 00 20 00 00 00 6f 00 00 00 6e 00 00 00 20 00 00 00 f6 00 00 00 e4 00 00 00 e5 00 00 00 d6 00 00 00 c4 00 00 00 c5 00 00 00 20 00 00 00 74 00 00 00 65 00 00 00 73 00 00 00 74 00 00 00 69 00 00 00 0a 00 00 00 00 === Tämä on öäåÃ&#150;Ã&#132;Ã&#133; testi Tämä on öäåÖÄÅ testi   1: Illegal seek 2: Success -------------------------------finish  Where   0: Success Testi Tämä on öäåÖÄÅ testi  should match  Tämä on öäåÃ&#150;Ã&#132;Ã&#133; testi === 0: Success Testi Tämä on This is taken from the following program:  #include <fstream> #include <iostream> #include <locale> #include <string> #include <cstdlib> #include <cerrno>  using namespace std;  int main() {   wchar_t dst[256];   unsigned char *ptr = (unsigned char *) dst;    char *src=http://www.golrleaf.com/ml/gcc-bugs/2004-03/"Tämä on öäåÃ&#150;Ã&#132;Ã&#133; testi  but does not.  The wofstream bits, do, indeed, work as expected.  -benjamin  --             Summary: UTF-8 encoding, wcout vs. file            Product: gcc            Version: 3.5.0             Status: UNCONFIRMED           Severity: normal           Priority: P2          Component: libstdc++         AssignedTo: unassigned at gcc dot gnu dot org         ReportedBy: bkoz at gcc dot gnu dot org                 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 the FC1 / Red Hat bug tracking system. It"s #112192  For for öäåÃ&#150;Ã&#132;Ã&#133; testi\n";    locale::global(locale("en_US.UTF-8"));   cout << locale().name() << endl;   wcout.imbue(locale());   cout.imbue(locale());    //typedef std::codecvt_byname<wchar_t, char, std::mbstate_t> Cvt;   //const std::locale unicode(std::locale ("C"), new Cvt("UTF-8"));     int i = mbstowcs(dst, src, 255);   printf(">%d< %d\n", i, sizeof(dst));     : [Bug libstdc++/14623] New: UTF-8 encoding, wcout vs. file  


Date Prev . Author Index ] Date Index ] [ Thread Index -- Subject Index From
GCC project ] Message Nav: ] [ Date Next ] ] Subject Index Raw text Thread Next ]