charsets.c revision 9c9af2590af49bb395bc8d2eace0f2d4ea16d165
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright (c) 2001 Apple Computer, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * @APPLE_LICENSE_HEADER_START@
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Reserved. This file contains Original Code and/or Modifications of
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Original Code as defined in and that are subject to the Apple Public
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * Source License Version 1.0 (the 'License'). You may not use this file
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * except in compliance with the License. Please obtain a copy of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * License at http://www.apple.com/publicsource and read it before using
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * this file.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The Original Code and all software distributed under the License are
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * License for the specific language governing rights and limitations
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * under the License."
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * @APPLE_LICENSE_HEADER_END@
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* CSTYLED */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * (c) 2004 Apple Computer, Inc. All Rights Reserved
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * charsets.c -- Routines converting between UTF-8, 16-bit
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * little-endian Unicode, and various Windows
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * code pages.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * MODIFICATION HISTORY:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * 28-Nov-2004 Guy Harris New today
#include "charsets.h"
xtoi(char u)
if (isdigit(u))
else if (islower(u))
else if (isupper(u))
return (component);
for (s = component; (c = *s) != 0; s++) {
return (component);
#ifdef NOTPORTED
static CFStringEncoding
get_windows_encoding_equivalent( void )
switch ( index )
case kCFStringEncodingMacThai:
return encoding;
#ifdef NOTPORTED
CFStringRef s;
char *result;
if (s == NULL) {
if (s == NULL) {
smb_error("CFStringCreateWithCString for Windows code page failed on \"%s\" with kCFStringEncodingMacRoman - skipping",
return NULL;
CFRelease(s);
return NULL;
CFRelease(s);
return NULL;
CFRelease(s);
return result;
#ifdef NOTPORTED
CFStringRef s;
char *result;
if (s == NULL) {
return NULL;
CFRelease(s);
return NULL;
CFRelease(s);
return NULL;
CFRelease(s);
return result;
* with new code in: utf_str.c