Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 27d7be10880322be5cb7839a7e6a19ba3f98003b
Ticket: 217987ffffffffffffffffffffffffffffffffff
Backslash substitution is broken with non-ASCII chars
User & Date: nobody on 2000-10-26 00:47:11
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 6162 Bug
    Version: 8.3.2
    SubmitDate: '2000-08-23'
    LastModified: '2000-09-05'
    Severity: MED
    Status: Closed
    Submitter: techsupp
    ChangedBy: hobbs
    RelatedBugIDs: 6166
    OS: Windows NT
    FixedDate: '2000-09-05'
    ClosedDate: '2000-10-25'
    
    
    Name:
    
    Benjamin Riefenstahl
    
    
    
    CVS:
    
    tclUtf.c,v 1.11 2000/01/11 22:09:00 hobbs Exp
    
    
    
    Comments:
    
    The patch is against the tcl-8.3.3 branch.
    
    
    
    ReproducibleScript:
    
    puts \ä
    
    
    
    ObservedBehavior:
    
    The script above displays garbage.
    
    
    
    DesiredBehavior:
    
    The script above should produce one line with an "ä".
    
    
    
    Patch:
    
    Index: tclUtf.c
    
    ===================================================================
    
    RCS file: /cvsroot/tcl/generic/tclUtf.c,v
    
    retrieving revision 1.11
    
    diff -c -r1.11 tclUtf.c
    
    *** tclUtf.c2000/01/11 22:09:001.11
    
    --- tclUtf.c2000/08/23 18:54:26
    
    ***************
    
    *** 781,787 ****
    
       * backslash sequence. */
    
      {
    
          register CONST char *p = src+1;
    
    !     int result, count, n;
    
          char buf[TCL_UTF_MAX];
    
      
    
          if (dst == NULL) {
    
    --- 781,787 ----
    
       * backslash sequence. */
    
      {
    
          register CONST char *p = src+1;
    
    !     int result, count, n, utfconvert;
    
          char buf[TCL_UTF_MAX];
    
      
    
          if (dst == NULL) {
    
    ***************
    
    *** 789,794 ****
    
    --- 789,795 ----
    
          }
    
      
    
          count = 2;
    
    +     utfconvert = 0;
    
          switch (*p) {
    
      /*
    
               * Note: in the conversions below, use absolute values (e.g.,
    
    ***************
    
    *** 823,828 ****
    
    --- 824,830 ----
    
                  if (isxdigit(UCHAR(p[1]))) { /* INTL: digit */
    
                      char *end;
    
      
    
    + utfconvert = 1;
    
                      result = (unsigned char) strtoul(p+1, &end, 16);
    
                      count = end - src;
    
                  } else {
    
    ***************
    
    *** 831,836 ****
    
    --- 833,839 ----
    
                  }
    
                  break;
    
      case 'u':
    
    +     utfconvert = 1;
    
          result = 0;
    
          for (count = 0; count < 4; count++) {
    
      p++;
    
    ***************
    
    *** 868,873 ****
    
    --- 871,877 ----
    
           * Check for an octal number \oo?o?
    
           */
    
          if (isdigit(UCHAR(*p)) && (UCHAR(*p) < '8')) { /* INTL: digit */
    
    + utfconvert = 1;
    
      result = (unsigned char)(*p - '0');
    
      p++;
    
      if (!isdigit(UCHAR(*p)) || (UCHAR(*p) >= '8')) { /* INTL: digit */
    
    ***************
    
    *** 891,897 ****
    
          if (readPtr != NULL) {
    
      *readPtr = count;
    
          }
    
    !     return Tcl_UniCharToUtf(result, dst);
    
      }
    
      
    
      /*
    
    --- 895,906 ----
    
          if (readPtr != NULL) {
    
      *readPtr = count;
    
          }
    
    !     if (!utfconvert) {
    
    ! *dst = (char) result;
    
    ! return 1;
    
    !     } else {
    
    ! return Tcl_UniCharToUtf(result, dst);
    
    !     }
    
      }
    
      
    
      /*
    
    
    
    PatchFiles:
    
    tclUtf.c
    
    
    
    
    
    
    
  4. foundin changed to: "obsolete: 8.3.2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to:
    Backslash substitution is broken with non-ASCII chars
    
  11. type changed to: "Bug"