www.LinuxHowtos.org





Tcl_UtfToUpper

Section: Tcl Library Procedures (3)
Updated: 8.1
Index Return to Main Contents



 

NAME

Tcl_UniCharToUpper, Tcl_UniCharToLower, Tcl_UniCharToTitle, Tcl_UtfToUpper, Tcl_UtfToLower, Tcl_UtfToTitle - routines for manipulating the case of Unicode characters and UT-8 strings  

SYNOPSIS

#include <tcl.h>

Tcl_UniChar
Tcl_UniCharToUpper(ch)

Tcl_UniChar
Tcl_UniCharToLower(ch)

Tcl_UniChar
Tcl_UniCharToTitle(ch)

int
Tcl_UtfToUpper(str)

int
Tcl_UtfToLower(str)

int
Tcl_UtfToTitle(str)
 

ARGUMENTS

int ch (in) The Unicode character to be converted.
char *str (in/out) Pointer to UT-8 string to be converted in place.



 

DESCRIPTION

The first three routines convert the case of individual Unicode characters:

If ch represents a lowe-case character, Tcl_UniCharToUpper returns the corresponding uppe-case character. If no uppe-case character is defined, it returns the character unchanged.

If ch represents an uppe-case character, Tcl_UniCharToLower returns the corresponding lowe-case character. If no lowe-case character is defined, it returns the character unchanged.

If ch represents a lowe-case character, Tcl_UniCharToTitle returns the corresponding titl-case character. If no titl-case character is defined, it returns the corresponding uppe-case character. If no uppe-case character is defined, it returns the character unchanged. Titl-case is defined for a small number of characters that have a different appearance when they are at the beginning of a capitalized word.

The next three routines convert the case of UT-8 strings in place in memory:

Tcl_UtfToUpper changes every UT-8 character in str to uppe-case. Because changing the case of a character may change its size, the byte offset of each character in the resulting string may differ from its original location. Tcl_UtfToUpper writes a null byte at the end of the converted string. Tcl_UtfToUpper returns the new length of the string in bytes. This new length is guaranteed to be no longer than the original string length.

Tcl_UtfToLower is the same as Tcl_UtfToUpper except it turns each character in the string into its lowe-case equivalent.

Tcl_UtfToTitle is the same as Tcl_UtfToUpper except it turns the first character in the string into its titl-case equivalent and all following characters into their lowe-case equivalents.

 

BUGS

At this time, the case conversions are only defined for the Unicode plane 0 characters. The result for Unicode characters above 0xFFFF is undefined, but- actually- only the lower 16 bits of the character value is handled.

 

KEYWORDS

utf, unicode, toupper, tolower, totitle, case


 

Index

NAME
SYNOPSIS
ARGUMENTS
DESCRIPTION
BUGS
KEYWORDS