Project

General

Profile

0001-An-UTF-8-character-is-now-used-to-represent-the-ASCI.patch

Patch to fix the issue by replacing the control characters by their UTF-8 representation. - Gallaecio, 12/01/2012 06:11 PM

View differences:

src/uisupport/uistyle.cpp
563 563
{
564 564
    QString mirc = mirc_;
565 565
    mirc.replace('%', "%%");    // escape % just to be sure
566
    mirc.replace('\t', "        ");    // tabs break layout, also this is italics in Konversation
567
    mirc.replace('\x02', "%B");
568
    mirc.replace('\x0f', "%O");
569
    mirc.replace('\x12', "%R");
570
    mirc.replace('\x16', "%R");
571
    mirc.replace('\x1d', "%S");
572
    mirc.replace('\x1f', "%U");
566

  
567
    // ASCII Control Characters.
568
    //
569
    // There are some unicode characters reserved for representing control characters when it is necessary to print them
570
    // rather than have them perform their intended function.
571
    //
572
    // So, for those that are not given a functionality, the UTF-8 character will be used instead.
573
    //
574
    // See: http://en.wikipedia.org/wiki/ASCII#ASCII_control_characters
575
    //
576
    // The null character, ‘\x00’, is never found in the string.
577
    // The start of header, ‘\x01’, is never found in the string.
578
    mirc.replace('\x02', "%B"); // Bold.
579
    // ‘\x03’ will be managed later, for color stuff.
580
    mirc.replace('\x04', QString::fromUtf8("␄"));
581
    mirc.replace('\x05', QString::fromUtf8("␅"));
582
    mirc.replace('\x06', QString::fromUtf8("␆"));
583
    mirc.replace('\x07', QString::fromUtf8("␇"));
584
    mirc.replace('\x08', QString::fromUtf8("␈"));
585
    mirc.replace('\x09', "        "); // Tab, in spaces.
586
    // No need to manage ‘\x0a’, line feeds end the message and write the following characters in another message.
587
    mirc.replace('\x0b', QString::fromUtf8("␋"));
588
    mirc.replace('\x0c', QString::fromUtf8("␌"));
589
    // The carriage return, ‘\x0d’, is never found in the string.
590
    mirc.replace('\x0d', QString::fromUtf8("␍"));
591
    mirc.replace('\x0e', QString::fromUtf8("␎"));
592
    mirc.replace('\x0f', "%O"); // ?
593
    mirc.replace('\x10', QString::fromUtf8("␐"));
594
    mirc.replace('\x11', QString::fromUtf8("␑"));
595
    mirc.replace('\x12', "%R"); // ?
596
    mirc.replace('\x13', QString::fromUtf8("␓"));
597
    mirc.replace('\x14', QString::fromUtf8("␔"));
598
    mirc.replace('\x15', QString::fromUtf8("␕"));
599
    mirc.replace('\x16', "%R"); // ?
600
    mirc.replace('\x17', QString::fromUtf8("␗"));
601
    mirc.replace('\x18', QString::fromUtf8("␘"));
602
    mirc.replace('\x19', QString::fromUtf8("␙"));
603
    mirc.replace('\x1a', QString::fromUtf8("␚"));
604
    mirc.replace('\x1b', QString::fromUtf8("␛"));
605
    mirc.replace('\x1c', QString::fromUtf8("␜"));
606
    mirc.replace('\x1d', "%S"); // Italics.
607
    mirc.replace('\x1e', QString::fromUtf8("␞"));
608
    mirc.replace('\x1f', "%U"); // Underlined.
609

  
610
    mirc.replace('\x7f', QString::fromUtf8("␡"));
573 611

  
574 612
    // Now we bring the color codes (\x03) in a sane format that can be parsed more easily later.
575 613
    // %Dcfxx is foreground, %Dcbxx is background color, where xx is a 2 digit dec number denoting the color code.
576
-