1/****************************************************************** 2 3 Copyright 1993 by SunSoft, Inc. 4 Copyright 1999-2000 by Bruno Haible 5 6Permission to use, copy, modify, distribute, and sell this software 7and its documentation for any purpose is hereby granted without fee, 8provided that the above copyright notice appear in all copies and 9that both that copyright notice and this permission notice appear 10in supporting documentation, and that the names of SunSoft, Inc. and 11Bruno Haible not be used in advertising or publicity pertaining to 12distribution of the software without specific, written prior 13permission. SunSoft, Inc. and Bruno Haible make no representations 14about the suitability of this software for any purpose. It is 15provided "as is" without express or implied warranty. 16 17SunSoft Inc. AND Bruno Haible DISCLAIM ALL WARRANTIES WITH REGARD 18TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 19AND FITNESS, IN NO EVENT SHALL SunSoft, Inc. OR Bruno Haible BE LIABLE 20FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 21WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 22ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 23OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 24 25******************************************************************/ 26 27/* 28 * This file contains the UTF-8 locale loader. 29 * Supports: all locales with codeset UTF-8. 30 * Platforms: all systems. 31 */ 32 33#ifdef HAVE_CONFIG_H 34#include <config.h> 35#endif 36#include <stdio.h> 37#include "Xlibint.h" 38#include "XlcPubI.h" 39#include "XlcGeneric.h" 40 41XLCd 42_XlcUtf8Loader( 43 const char *name) 44{ 45 XLCd lcd; 46 47 lcd = _XlcCreateLC(name, _XlcGenericMethods); 48 if (lcd == (XLCd) NULL) 49 return lcd; 50 51 /* The official IANA name for UTF-8 is "UTF-8" in upper case with a dash. */ 52 if (!XLC_PUBLIC_PART(lcd)->codeset) { 53 _XlcDestroyLC(lcd); 54 return (XLCd) NULL; 55 } 56 else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8")) { 57 _XlcAddUtf8LocaleConverters(lcd); 58 } 59 else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "GB18030")) { 60 _XlcAddGB18030LocaleConverters(lcd); 61 } 62 else { 63 _XlcDestroyLC(lcd); 64 return (XLCd) NULL; 65 } 66 67 _XlcAddUtf8Converters(lcd); 68 69 return lcd; 70} 71