| 1 |
'\" |
| 2 |
'\" Copyright (c) 1997 Sun Microsystems, Inc. |
| 3 |
'\" |
| 4 |
'\" See the file "license.terms" for information on usage and redistribution |
| 5 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 6 |
'\" |
| 7 |
.TH Tcl_UtfToUpper 3 "8.1" Tcl "Tcl Library Procedures" |
| 8 |
.so man.macros |
| 9 |
.BS |
| 10 |
.SH NAME |
| 11 |
Tcl_UniCharToUpper, Tcl_UniCharToLower, Tcl_UniCharToTitle, Tcl_UtfToUpper, Tcl_UtfToLower, Tcl_UtfToTitle \- routines for manipulating the case of Unicode characters and UTF-8 strings |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
\fB#include <tcl.h>\fR |
| 15 |
.sp |
| 16 |
Tcl_UniChar |
| 17 |
\fBTcl_UniCharToUpper\fR(\fIch\fR) |
| 18 |
.sp |
| 19 |
Tcl_UniChar |
| 20 |
\fBTcl_UniCharToLower\fR(\fIch\fR) |
| 21 |
.sp |
| 22 |
Tcl_UniChar |
| 23 |
\fBTcl_UniCharToTitle\fR(\fIch\fR) |
| 24 |
.sp |
| 25 |
int |
| 26 |
\fBTcl_UtfToUpper\fR(\fIstr\fR) |
| 27 |
.sp |
| 28 |
int |
| 29 |
\fBTcl_UtfToLower\fR(\fIstr\fR) |
| 30 |
.sp |
| 31 |
int |
| 32 |
\fBTcl_UtfToTitle\fR(\fIstr\fR) |
| 33 |
.SH ARGUMENTS |
| 34 |
.AS char *str in/out |
| 35 |
.AP int ch in |
| 36 |
The Unicode character to be converted. |
| 37 |
.AP char *str in/out |
| 38 |
Pointer to UTF-8 string to be converted in place. |
| 39 |
.BE |
| 40 |
|
| 41 |
.SH DESCRIPTION |
| 42 |
.PP |
| 43 |
The first three routines convert the case of individual Unicode characters: |
| 44 |
.PP |
| 45 |
If \fIch\fR represents a lower-case character, |
| 46 |
\fBTcl_UniCharToUpper\fR returns the corresponding upper-case |
| 47 |
character. If no upper-case character is defined, it returns the |
| 48 |
character unchanged. |
| 49 |
.PP |
| 50 |
If \fIch\fR represents an upper-case character, |
| 51 |
\fBTcl_UniCharToLower\fR returns the corresponding lower-case |
| 52 |
character. If no lower-case character is defined, it returns the |
| 53 |
character unchanged. |
| 54 |
.PP |
| 55 |
If \fIch\fR represents a lower-case character, |
| 56 |
\fBTcl_UniCharToTitle\fR returns the corresponding title-case |
| 57 |
character. If no title-case character is defined, it returns the |
| 58 |
corresponding upper-case character. If no upper-case character is |
| 59 |
defined, it returns the character unchanged. Title-case is defined |
| 60 |
for a small number of characters that have a different appearance when |
| 61 |
they are at the beginning of a capitalized word. |
| 62 |
.PP |
| 63 |
The next three routines convert the case of UTF-8 strings in place in |
| 64 |
memory: |
| 65 |
.PP |
| 66 |
\fBTcl_UtfToUpper\fR changes every UTF-8 character in \fIstr\fR to |
| 67 |
upper-case. Because changing the case of a character may change its |
| 68 |
size, the byte offset of each character in the resulting string may |
| 69 |
differ from its original location. \fBTcl_UtfToUpper\fR writes a null |
| 70 |
byte at the end of the converted string. \fBTcl_UtfToUpper\fR returns |
| 71 |
the new length of the string in bytes. This new length is guaranteed |
| 72 |
to be no longer than the original string length. |
| 73 |
.PP |
| 74 |
\fBTcl_UtfToLower\fR is the same as \fBTcl_UtfToUpper\fR except it |
| 75 |
turns each character in the string into its lower-case equivalent. |
| 76 |
.PP |
| 77 |
\fBTcl_UtfToTitle\fR is the same as \fBTcl_UtfToUpper\fR except it |
| 78 |
turns the first character in the string into its title-case equivalent |
| 79 |
and all following characters into their lower-case equivalents. |
| 80 |
|
| 81 |
.SH BUGS |
| 82 |
.PP |
| 83 |
At this time, the case conversions are only defined for the Unicode |
| 84 |
plane 0 characters. The result for Unicode characters above 0xFFFF |
| 85 |
is undefined, but - actually - only the lower 16 bits of the |
| 86 |
character value is handled. |
| 87 |
|
| 88 |
.SH KEYWORDS |
| 89 |
utf, unicode, toupper, tolower, totitle, case |