lcUTF8Load.c revision 1ab64890
11ab64890Smrg/* $TOG: $ */ 21ab64890Smrg/****************************************************************** 31ab64890Smrg 41ab64890Smrg Copyright 1993 by SunSoft, Inc. 51ab64890Smrg Copyright 1999-2000 by Bruno Haible 61ab64890Smrg 71ab64890SmrgPermission to use, copy, modify, distribute, and sell this software 81ab64890Smrgand its documentation for any purpose is hereby granted without fee, 91ab64890Smrgprovided that the above copyright notice appear in all copies and 101ab64890Smrgthat both that copyright notice and this permission notice appear 111ab64890Smrgin supporting documentation, and that the names of SunSoft, Inc. and 121ab64890SmrgBruno Haible not be used in advertising or publicity pertaining to 131ab64890Smrgdistribution of the software without specific, written prior 141ab64890Smrgpermission. SunSoft, Inc. and Bruno Haible make no representations 151ab64890Smrgabout the suitability of this software for any purpose. It is 161ab64890Smrgprovided "as is" without express or implied warranty. 171ab64890Smrg 181ab64890SmrgSunSoft Inc. AND Bruno Haible DISCLAIM ALL WARRANTIES WITH REGARD 191ab64890SmrgTO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 201ab64890SmrgAND FITNESS, IN NO EVENT SHALL SunSoft, Inc. OR Bruno Haible BE LIABLE 211ab64890SmrgFOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 221ab64890SmrgWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 231ab64890SmrgACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 241ab64890SmrgOF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 251ab64890Smrg 261ab64890Smrg******************************************************************/ 271ab64890Smrg/* $XFree86: xc/lib/X11/lcUTF8.c,v 1.12 2001/02/09 00:02:53 dawes Exp $ */ 281ab64890Smrg 291ab64890Smrg/* 301ab64890Smrg * This file contains the UTF-8 locale loader. 311ab64890Smrg * Supports: all locales with codeset UTF-8. 321ab64890Smrg * Platforms: all systems. 331ab64890Smrg */ 341ab64890Smrg 351ab64890Smrg#ifdef HAVE_CONFIG_H 361ab64890Smrg#include <config.h> 371ab64890Smrg#endif 381ab64890Smrg#include <stdio.h> 391ab64890Smrg#include "Xlibint.h" 401ab64890Smrg#include "XlcPubI.h" 411ab64890Smrg#include "XlcGeneric.h" 421ab64890Smrg 431ab64890SmrgXLCd 441ab64890Smrg_XlcUtf8Loader( 451ab64890Smrg const char *name) 461ab64890Smrg{ 471ab64890Smrg XLCd lcd; 481ab64890Smrg 491ab64890Smrg lcd = _XlcCreateLC(name, _XlcGenericMethods); 501ab64890Smrg if (lcd == (XLCd) NULL) 511ab64890Smrg return lcd; 521ab64890Smrg 531ab64890Smrg /* The official IANA name for UTF-8 is "UTF-8" in upper case with a dash. */ 541ab64890Smrg if (!XLC_PUBLIC_PART(lcd)->codeset || 551ab64890Smrg (_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8"))) { 561ab64890Smrg _XlcDestroyLC(lcd); 571ab64890Smrg return (XLCd) NULL; 581ab64890Smrg } 591ab64890Smrg 601ab64890Smrg _XlcAddUtf8LocaleConverters(lcd); 611ab64890Smrg _XlcAddUtf8Converters(lcd); 621ab64890Smrg 631ab64890Smrg return lcd; 641ab64890Smrg} 65