# TIP 20: Add C Locale-Exact CType Functions
Author: Jeffrey Hobbs <[email protected]>
State: Deferred
Type: Project
Tcl-Version: 8.5
Vote: Pending
Created: 08-Jan-2001
Post-History:
-----
# Abstract
This TIP adds functions to Tcl that are a subset of the standard ctype
functions \(isspace, isalpha, ...\) that are ensured to operate only in
the C locale \(char < 0x80\).
# Rationale
Tcl used to force the C locale everywhere in order to have parsing
work as expected throughout Tcl, but that prevented certain i18n
features from working correctly \(like native character input\). In
enabling the i18n features, some bugs \(like
<http://sf.net/bugs/?func=detailbug&bug_id=127512&group_id=10894> \)
were exposed that required the C locale to be enabled to function
properly. Since we don't want to force that requirement, creating
ctype functions that work as if they were always in the C locale is
the best solution.
# Reference Implementation
Add a file _generic/tclC.c_ \(to parallel _generic/tclUtf.c_\) that
contains functions following the convention C\_isspace, C\_isalpha, ...
These functions would use character or bit maps to ensure greatest
speed and efficiency of the functions.
Not all use of the ctype functions need be replaced. Those that walk
over a string, especially backwards, are the ones that need
replacement.
# Copyright
This document is in the public domain.