version 1.1.1.2, 2012/02/21 23:50:25
|
version 1.1.1.3, 2013/07/22 08:25:55
|
Line 45 character value into a UTF8 string. */
|
Line 45 character value into a UTF8 string. */
|
#include "config.h" |
#include "config.h" |
#endif |
#endif |
|
|
|
#define COMPILE_PCRE8 |
|
|
#include "pcre_internal.h" |
#include "pcre_internal.h" |
|
|
|
|
/************************************************* |
/************************************************* |
* Convert character value to UTF-8 * |
* Convert character value to UTF-8 * |
*************************************************/ |
*************************************************/ |
|
|
/* This function takes an integer value in the range 0 - 0x10ffff |
/* This function takes an integer value in the range 0 - 0x10ffff |
and encodes it as a UTF-8 character in 1 to 6 pcre_uchars. | and encodes it as a UTF-8 character in 1 to 4 pcre_uchars. |
|
|
Arguments: |
Arguments: |
cvalue the character value |
cvalue the character value |
Line 62 Arguments:
|
Line 63 Arguments:
|
Returns: number of characters placed in the buffer |
Returns: number of characters placed in the buffer |
*/ |
*/ |
|
|
|
unsigned |
int |
int |
PRIV(ord2utf)(pcre_uint32 cvalue, pcre_uchar *buffer) |
PRIV(ord2utf)(pcre_uint32 cvalue, pcre_uchar *buffer) |
{ |
{ |
#ifdef SUPPORT_UTF |
#ifdef SUPPORT_UTF |
|
|
register int i, j; |
register int i, j; |
|
|
/* Checking invalid cvalue character, encoded as invalid UTF-16 character. |
|
Should never happen in practice. */ |
|
if ((cvalue & 0xf800) == 0xd800 || cvalue >= 0x110000) |
|
cvalue = 0xfffe; |
|
|
|
for (i = 0; i < PRIV(utf8_table1_size); i++) |
for (i = 0; i < PRIV(utf8_table1_size); i++) |
if ((int)cvalue <= PRIV(utf8_table1)[i]) break; |
if ((int)cvalue <= PRIV(utf8_table1)[i]) break; |