public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33852]  New: incorrect text formating in "std::cout" with UTF-8
@ 2007-10-21 21:50 siegerstein at pochta dot ru
  2007-10-27 20:26 ` [Bug libstdc++/33852] " siegerstein at pochta dot ru
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: siegerstein at pochta dot ru @ 2007-10-21 21:50 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2376 bytes --]

Here is incorrect text formating with using cout() with setw() in UNICODE
(UTF-8)
Two text: first in English - correct formating, second - russian in UTF-8 -
incorrect.

#include <iostream>
#include <iomanip>

int main() {
        std::cout.setf(std::ios::left);
        std::cout.fill('_');

        std::cout << std::setw(15) << "Mixer" << std::setw(15) << "Device" <<
std::setw(15) << "Recording" <<
                        std::setw(15)   << "Active" << std::setw(15) <<
"Stereo" << std::setw(15) << "Current" << std::endl;
        std::cout << std::setw(15) << "Channel" << std::setw(15) << 
"Available" << std::setw(15) << "Source" <<
                        std::setw(15)   << "Source" << std::setw(15) <<
"Device" << std::setw(15) << "Level" << std::endl;

std::cout << std::endl;

// Russian text in UTF-8
// Not correct formating text....

        std::cout << std::setw(15) << "Êàíàë" << std::setw(15) << "Äîñòóïíîñòü"
<< std::setw(15) << "Èñòî÷íèê" <<
                        std::setw(15)   << "Àêòèâíîñòü" << std::setw(15) <<
"Ñòåðåî" << std::setw(15) << "Òåêóùèé" << std::endl;
        std::cout << std::setw(15) << "ìèêøåðà" << std::setw(15) << 
"óñòðîéñòâà" << std::setw(15) << "çàïèñè" <<
                        std::setw(15)   << "èñòî÷íèêà" << std::setw(15) <<
"óñòðîéñòâî" << std::setw(15) << "óðîâåíü" << std::endl;

        return 0;
}

$ g++-4.2.2 bug.cpp -o bug

RESULT:

Mixer__________Device_________Recording______Active_________Stereo_________Current________
Channel________Available______Source_________Source_________Device_________Level__________

Êàíàë_____ÄîñòóïíîñòüÈñòî÷íèêÀêòèâíîñòüÑòåðåî___Òåêóùèé_
ìèêøåðà_óñòðîéñòâàçàïèñè___èñòî÷íèêàóñòðîéñòâîóðîâåíü_


-- 
           Summary: incorrect text formating in "std::cout" with UTF-8
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: siegerstein at pochta dot ru
 GCC build triplet: i686-pc-linux
  GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-02-21  1:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-21 21:50 [Bug c++/33852] New: incorrect text formating in "std::cout" with UTF-8 siegerstein at pochta dot ru
2007-10-27 20:26 ` [Bug libstdc++/33852] " siegerstein at pochta dot ru
2007-10-27 20:28 ` siegerstein at pochta dot ru
2007-10-28  9:53 ` pcarlini at suse dot de
2010-02-21  1:05 ` manu at gcc dot gnu dot org
2010-02-21  1:31 ` paolo dot carlini at oracle dot com
2010-02-21  1:32 ` paolo dot carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).