Tcl Source Code

Check-in [33251a211f]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove incorrect comment. Simplify handling of last bytes in Tcl_UniCharToUtfDString(), since TclUtfToUniChar() already turns out to handle cp1252 fall-back correctly.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-branch
Files: files | file ages | folders
SHA3-256:33251a211f8d5c9d73232ba9295a1788e52a88388077343e171dba3e07f8f598
User & Date: jan.nijtmans 2019-03-21 19:56:55
Context
2019-03-21
20:10
Add entry for 元号 (or NewEra placeholder) to Unicode tables. Since Tcl doesn't do rendering, this... check-in: 1c7bbbc9c1 user: jan.nijtmans tags: core-8-branch
19:56
Remove incorrect comment. Simplify handling of last bytes in Tcl_UniCharToUtfDString(), since TclUt... check-in: 33251a211f user: jan.nijtmans tags: core-8-branch
07:45
Fix outdated comment check-in: ce566c5d84 user: jan.nijtmans tags: core-8-6-branch
2019-03-20
22:45
Fix Tcl_UtfToUniCharDString() function, handling invalid byte at the end of the string: Not quite co... check-in: 3e8ada19f5 user: jan.nijtmans tags: core-8-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/ToUpper.3.

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
\fBTcl_UtfToLower\fR is the same as \fBTcl_UtfToUpper\fR except it
turns each character in the string into its lower-case equivalent.
.PP
\fBTcl_UtfToTitle\fR is the same as \fBTcl_UtfToUpper\fR except it
turns the first character in the string into its title-case equivalent
and all following characters into their lower-case equivalents.

.SH BUGS
.PP
At this time, the case conversions are only defined for the ISO8859-1
characters.  Unicode characters above 0x00ff are not modified by these
routines.

.SH KEYWORDS
utf, unicode, toupper, tolower, totitle, case







<
<
<
<
<
<


74
75
76
77
78
79
80






81
82
\fBTcl_UtfToLower\fR is the same as \fBTcl_UtfToUpper\fR except it
turns each character in the string into its lower-case equivalent.
.PP
\fBTcl_UtfToTitle\fR is the same as \fBTcl_UtfToUpper\fR except it
turns the first character in the string into its title-case equivalent
and all following characters into their lower-case equivalents.







.SH KEYWORDS
utf, unicode, toupper, tolower, totitle, case

Changes to generic/tclUtf.c.

615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
...
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
    end = src + length - 4;
    while (p < end) {
	p += TclUtfToUniChar(p, &ch);
	*w++ = ch;
    }
    end += 4;
    while (p < end) {
	if (((unsigned)(UCHAR(*p)-0x80)) < 0x20) {
	    ch = cp1252[UCHAR(*p++)-0x80];
	} else if (Tcl_UtfCharComplete(p, end-p)) {
	    p += TclUtfToUniChar(p, &ch);
	} else {
	    ch = UCHAR(*p++);
	}
	*w++ = ch;
    }
    *w = '\0';
................................................................................
    end = src + length - 4;
    while (p < end) {
	p += TclUtfToWChar(p, &ch);
	*w++ = ch;
    }
    end += 4;
    while (p < end) {
	if (((unsigned)(UCHAR(*p)-0x80)) < 0x20) {
	    ch = cp1252[UCHAR(*p++)-0x80];
	} else if (Tcl_UtfCharComplete(p, end-p)) {
		    p += TclUtfToWChar(p, &ch);
	} else {
	    ch = UCHAR(*p++);
	}
	*w++ = ch;
    }
    *w = '\0';
    Tcl_DStringSetLength(dsPtr,







<
<
|







 







<
<
|
|







615
616
617
618
619
620
621


622
623
624
625
626
627
628
629
...
667
668
669
670
671
672
673


674
675
676
677
678
679
680
681
682
    end = src + length - 4;
    while (p < end) {
	p += TclUtfToUniChar(p, &ch);
	*w++ = ch;
    }
    end += 4;
    while (p < end) {


	if (Tcl_UtfCharComplete(p, end-p)) {
	    p += TclUtfToUniChar(p, &ch);
	} else {
	    ch = UCHAR(*p++);
	}
	*w++ = ch;
    }
    *w = '\0';
................................................................................
    end = src + length - 4;
    while (p < end) {
	p += TclUtfToWChar(p, &ch);
	*w++ = ch;
    }
    end += 4;
    while (p < end) {


	if (Tcl_UtfCharComplete(p, end-p)) {
	    p += TclUtfToWChar(p, &ch);
	} else {
	    ch = UCHAR(*p++);
	}
	*w++ = ch;
    }
    *w = '\0';
    Tcl_DStringSetLength(dsPtr,