| 1 |
<?php |
| 2 |
namespace UtfNormal; |
| 3 |
|
| 4 |
/** |
| 5 |
* Some constant definitions for the unicode normalization module. |
| 6 |
* |
| 7 |
* Note: these constants must all be resolvable at compile time by HipHop, |
| 8 |
* since this file will not be executed during request startup for a compiled |
| 9 |
* MediaWiki. |
| 10 |
* |
| 11 |
* This program is free software; you can redistribute it and/or modify |
| 12 |
* it under the terms of the GNU General Public License as published by |
| 13 |
* the Free Software Foundation; either version 2 of the License, or |
| 14 |
* (at your option) any later version. |
| 15 |
* |
| 16 |
* This program is distributed in the hope that it will be useful, |
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
* GNU General Public License for more details. |
| 20 |
* |
| 21 |
* You should have received a copy of the GNU General Public License along |
| 22 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 23 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 24 |
* http://www.gnu.org/copyleft/gpl.html |
| 25 |
* |
| 26 |
* @file |
| 27 |
* @ingroup UtfNormal |
| 28 |
*/ |
| 29 |
|
| 30 |
class Constants { |
| 31 |
public const UNICODE_HANGUL_FIRST = 0xac00; |
| 32 |
public const UNICODE_HANGUL_LAST = 0xd7a3; |
| 33 |
|
| 34 |
public const UNICODE_HANGUL_LBASE = 0x1100; |
| 35 |
public const UNICODE_HANGUL_VBASE = 0x1161; |
| 36 |
public const UNICODE_HANGUL_TBASE = 0x11a7; |
| 37 |
|
| 38 |
public const UNICODE_HANGUL_LCOUNT = 19; |
| 39 |
public const UNICODE_HANGUL_VCOUNT = 21; |
| 40 |
public const UNICODE_HANGUL_TCOUNT = 28; |
| 41 |
|
| 42 |
public const UNICODE_HANGUL_NCOUNT = self::UNICODE_HANGUL_VCOUNT * self::UNICODE_HANGUL_TCOUNT; |
| 43 |
|
| 44 |
public const UNICODE_HANGUL_LEND = self::UNICODE_HANGUL_LBASE + self::UNICODE_HANGUL_LCOUNT - 1; |
| 45 |
public const UNICODE_HANGUL_VEND = self::UNICODE_HANGUL_VBASE + self::UNICODE_HANGUL_VCOUNT - 1; |
| 46 |
public const UNICODE_HANGUL_TEND = self::UNICODE_HANGUL_TBASE + self::UNICODE_HANGUL_TCOUNT - 1; |
| 47 |
|
| 48 |
public const UNICODE_SURROGATE_FIRST = 0xd800; |
| 49 |
public const UNICODE_SURROGATE_LAST = 0xdfff; |
| 50 |
public const UNICODE_MAX = 0x10ffff; |
| 51 |
public const UNICODE_REPLACEMENT = 0xfffd; |
| 52 |
|
| 53 |
# codepointToUtf8( UNICODE_HANGUL_FIRST ) |
| 54 |
public const UTF8_HANGUL_FIRST = "\xea\xb0\x80"; |
| 55 |
# codepointToUtf8( UNICODE_HANGUL_LAST ) |
| 56 |
public const UTF8_HANGUL_LAST = "\xed\x9e\xa3"; |
| 57 |
|
| 58 |
# codepointToUtf8( UNICODE_HANGUL_LBASE ) |
| 59 |
public const UTF8_HANGUL_LBASE = "\xe1\x84\x80"; |
| 60 |
# codepointToUtf8( UNICODE_HANGUL_VBASE ) |
| 61 |
public const UTF8_HANGUL_VBASE = "\xe1\x85\xa1"; |
| 62 |
# codepointToUtf8( UNICODE_HANGUL_TBASE ) |
| 63 |
public const UTF8_HANGUL_TBASE = "\xe1\x86\xa7"; |
| 64 |
|
| 65 |
# codepointToUtf8( UNICODE_HANGUL_LEND ) |
| 66 |
public const UTF8_HANGUL_LEND = "\xe1\x84\x92"; |
| 67 |
# codepointToUtf8( UNICODE_HANGUL_VEND ) |
| 68 |
public const UTF8_HANGUL_VEND = "\xe1\x85\xb5"; |
| 69 |
# codepointToUtf8( UNICODE_HANGUL_TEND ) |
| 70 |
public const UTF8_HANGUL_TEND = "\xe1\x87\x82"; |
| 71 |
|
| 72 |
# codepointToUtf8( UNICODE_SURROGATE_FIRST ) |
| 73 |
public const UTF8_SURROGATE_FIRST = "\xed\xa0\x80"; |
| 74 |
# codepointToUtf8( UNICODE_SURROGATE_LAST ) |
| 75 |
public const UTF8_SURROGATE_LAST = "\xed\xbf\xbf"; |
| 76 |
# codepointToUtf8( UNICODE_MAX ) |
| 77 |
public const UTF8_MAX = "\xf4\x8f\xbf\xbf"; |
| 78 |
# codepointToUtf8( UNICODE_REPLACEMENT ) |
| 79 |
public const UTF8_REPLACEMENT = "\xef\xbf\xbd"; |
| 80 |
# public const UTF8_REPLACEMENT = '!'; |
| 81 |
|
| 82 |
public const UTF8_OVERLONG_A = "\xc1\xbf"; |
| 83 |
public const UTF8_OVERLONG_B = "\xe0\x9f\xbf"; |
| 84 |
public const UTF8_OVERLONG_C = "\xf0\x8f\xbf\xbf"; |
| 85 |
|
| 86 |
# These two ranges are illegal |
| 87 |
# codepointToUtf8( 0xfdd0 ) |
| 88 |
public const UTF8_FDD0 = "\xef\xb7\x90"; |
| 89 |
# codepointToUtf8( 0xfdef ) |
| 90 |
public const UTF8_FDEF = "\xef\xb7\xaf"; |
| 91 |
# codepointToUtf8( 0xfffe ) |
| 92 |
public const UTF8_FFFE = "\xef\xbf\xbe"; |
| 93 |
# codepointToUtf8( 0xffff ) |
| 94 |
public const UTF8_FFFF = "\xef\xbf\xbf"; |
| 95 |
|
| 96 |
public const UTF8_HEAD = false; |
| 97 |
public const UTF8_TAIL = true; |
| 98 |
|
| 99 |
} |