contributions/text.unidecode/start.inc.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * @defgroup Unidecode 00004 * @ingroup Text 00005 * 00006 * It often happens that you have non-Roman text data in Unicode, but 00007 * you can't display it -- usually because you're trying to show it 00008 * to a user via an application that doesn't support Unicode, or 00009 * because the fonts you need aren't accessible. You could represent 00010 * the Unicode characters as "???????" or "\15BA\15A0\1610...", but 00011 * that's nearly useless to the user who actually wants to read what 00012 * the text says. 00013 00014 * What Unidecode provides is a function, that 00015 * takes Unicode data and tries to represent it in ASCII characters 00016 * (i.e., the universally displayable characters between 0x00 and 0x7F). 00017 * The representation is almost always an attempt at *transliteration* 00018 * -- i.e., conveying, in Roman letters, the pronunciation expressed by 00019 * the text in some other writing system. (See the example above) 00020 * 00021 * @section Usage Usage 00022 * 00023 * @code 00024 * print ConverterFactory::encode("\x53\17\x4E\B0", CONVERTER_UNIDECODE, 'UTF-16'); 00025 * // prints: Bei Jing 00026 * @endcode 00027 * 00028 * Ommit encoding when dealing with strings in default encoding 00029 * 00030 * @code 00031 * print ConverterFactory::encode('Jürgen\'s Café offers à la carte', CONVERTER_UNIDECODE); 00032 * // prints: Jurgen's Cafe offers a la carte 00033 * @endcode 00034 * 00035 * @section Notes Additional notes 00036 * 00037 * This is a port of the Tomaz Solc's <tomaz@zemanta.com> Python port of the 00038 * Text::Unidecode Perl module by Sean M. Burke <sburke@cpan.org>. 00039 * 00040 * 00041 * Character transliteration tables copyright 2001, Sean M. Burke <sburke@cpan.org>, 00042 * all rights reserved. http://search.cpan.org/~sburke/Text-Unidecode-0.04/ 00043 * 00044 * Python code copyright 2009, Tomaz Solc <tomaz@zemanta.com>, 00045 * http://pypi.python.org/pypi/Unidecode 00046 */ 00047 define ('CONVERTER_UNIDECODE', 'unidecode'); 00048 00049 require_once dirname(__FILE__) . '/lib/helpers/converters/unidecode.converter.php'; 00050 ConverterFactory::register_converter(CONVERTER_UNIDECODE, new ConverterUnidecode());