com.caucho.quercus.lib.i18n
Class UnicodeModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.i18n.UnicodeModule
All Implemented Interfaces:
QuercusModule

public class UnicodeModule
extends AbstractQuercusModule

Unicode handling. Also includes iconv, etc.


Field Summary
static java.lang.String ICONV_IMPL
           
static int ICONV_MIME_DECODE_CONTINUE_ON_ERROR
           
static int ICONV_MIME_DECODE_STRICT
           
static java.lang.String ICONV_VERSION
           
static int U_INVALID_ESCAPE
           
static int U_INVALID_SKIP
           
static int U_INVALID_STOP
           
static int U_INVALID_SUBSTITUTE
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
UnicodeModule()
           
 
Method Summary
 IniDefinitions getIniDefinitions()
          Returns the default quercus.ini values.
 java.lang.String[] getLoadedExtensions()
          Returns the extensions implemented by the module.
static Value iconv_get_encoding(Env env, java.lang.String type)
          Returns the current encoding.
static Value iconv_mime_decode_headers(Env env, StringValue encoded_headers, int mode, java.lang.String charset)
          Decodes all the headers and place them in an array.
static Value iconv_mime_decode(Env env, StringValue encodedHeader, int mode, java.lang.String charset)
          Uses iconv.internal_encoding.
static Value iconv_mime_encode(Env env, StringValue fieldName, StringValue fieldValue, ArrayValue preferences)
          Encodes a MIME header.
static BooleanValue iconv_set_encoding(Env env, java.lang.String type, StringValue charset)
          Sets the current encoding.
static Value iconv_strlen(Env env, StringValue str, java.lang.String charset)
          Returns the length of the decoded string.
static Value iconv_strpos(Env env, StringValue haystack, StringValue needle, int offset, java.lang.String charset)
          Returns the first occurence of the substring in the haystack.
static Value iconv_strrpos(Env env, StringValue haystack, StringValue needle, java.lang.String charset)
          Returns the last occurence of the substring in the haystack.
static Value iconv_substr(Env env, StringValue str, int offset, int length, java.lang.String charset)
          Uses iconv.internal_encoding.
static Value iconv(Env env, java.lang.String inCharset, java.lang.String outCharset, StringValue str)
          Returns encoded string from decoded argument string.
static StringValue ob_iconv_handler(StringValue contents, int status)
           
static Value unicode_decode(Env env, BinaryValue str, java.lang.String encoding, int errorMode)
           
static Value unicode_encode(Env env, UnicodeValue str, java.lang.String encoding, int errorMode)
           
static BooleanValue unicode_semantics(Env env)
           
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getConstMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

U_INVALID_STOP

public static final int U_INVALID_STOP
See Also:
Constant Field Values

U_INVALID_SKIP

public static final int U_INVALID_SKIP
See Also:
Constant Field Values

U_INVALID_SUBSTITUTE

public static final int U_INVALID_SUBSTITUTE
See Also:
Constant Field Values

U_INVALID_ESCAPE

public static final int U_INVALID_ESCAPE
See Also:
Constant Field Values

ICONV_IMPL

public static final java.lang.String ICONV_IMPL
See Also:
Constant Field Values

ICONV_VERSION

public static final java.lang.String ICONV_VERSION
See Also:
Constant Field Values

ICONV_MIME_DECODE_STRICT

public static final int ICONV_MIME_DECODE_STRICT
See Also:
Constant Field Values

ICONV_MIME_DECODE_CONTINUE_ON_ERROR

public static final int ICONV_MIME_DECODE_CONTINUE_ON_ERROR
See Also:
Constant Field Values
Constructor Detail

UnicodeModule

public UnicodeModule()
Method Detail

getLoadedExtensions

public java.lang.String[] getLoadedExtensions()
Returns the extensions implemented by the module.

Specified by:
getLoadedExtensions in interface QuercusModule
Overrides:
getLoadedExtensions in class AbstractQuercusModule

getIniDefinitions

public IniDefinitions getIniDefinitions()
Returns the default quercus.ini values.

Specified by:
getIniDefinitions in interface QuercusModule
Overrides:
getIniDefinitions in class AbstractQuercusModule

unicode_semantics

public static BooleanValue unicode_semantics(Env env)

unicode_decode

public static Value unicode_decode(Env env,
                                   BinaryValue str,
                                   java.lang.String encoding,
                                   int errorMode)

unicode_encode

public static Value unicode_encode(Env env,
                                   UnicodeValue str,
                                   java.lang.String encoding,
                                   int errorMode)

iconv_strpos

public static Value iconv_strpos(Env env,
                                 StringValue haystack,
                                 StringValue needle,
                                 int offset,
                                 java.lang.String charset)
Returns the first occurence of the substring in the haystack. Uses iconv.internal_encoding.

Returns:
first occurence of needle in haystack, FALSE otherwise

iconv_strrpos

public static Value iconv_strrpos(Env env,
                                  StringValue haystack,
                                  StringValue needle,
                                  java.lang.String charset)
Returns the last occurence of the substring in the haystack. Uses iconv.internal_encoding.

Parameters:
charset - encoding of StringValue arguments
Returns:
last occurence of needle in haystack, FALSE otherwise

iconv_substr

public static Value iconv_substr(Env env,
                                 StringValue str,
                                 int offset,
                                 int length,
                                 java.lang.String charset)
Uses iconv.internal_encoding.

Parameters:
env -
str - encoded string
offset - of str after decoding
length - of str after decoding
charset - encoding of StringValue argument
Returns:
substring of argument string.

iconv

public static Value iconv(Env env,
                          java.lang.String inCharset,
                          java.lang.String outCharset,
                          StringValue str)
Returns encoded string from decoded argument string.

Parameters:
env -
inCharset - charset to decode from
outCharset - charset to decode to
str - to decode and encode

ob_iconv_handler

public static StringValue ob_iconv_handler(StringValue contents,
                                           int status)

iconv_get_encoding

public static Value iconv_get_encoding(Env env,
                                       java.lang.String type)
Returns the current encoding.

Parameters:
env -
type - setting to return
Returns:
iconv environment settings

iconv_set_encoding

public static BooleanValue iconv_set_encoding(Env env,
                                              java.lang.String type,
                                              StringValue charset)
Sets the current encoding.

Parameters:
env -
type -
charset -

iconv_strlen

public static Value iconv_strlen(Env env,
                                 StringValue str,
                                 java.lang.String charset)
Returns the length of the decoded string. Uses iconv.internal_encoding.

Parameters:
env -
str -
charset -

iconv_mime_encode

public static Value iconv_mime_encode(Env env,
                                      StringValue fieldName,
                                      StringValue fieldValue,
                                      ArrayValue preferences)
Encodes a MIME header. XXX: preferences

Parameters:
fieldName - header field name
fieldValue - header field value
preferences -

iconv_mime_decode_headers

public static Value iconv_mime_decode_headers(Env env,
                                              StringValue encoded_headers,
                                              int mode,
                                              java.lang.String charset)
Decodes all the headers and place them in an array. Use iconv.internal_encoding. XXX: mode, line-length, line-break-chars

Parameters:
env -
encoded_headers -
mode - controls error recovery
charset -

iconv_mime_decode

public static Value iconv_mime_decode(Env env,
                                      StringValue encodedHeader,
                                      int mode,
                                      java.lang.String charset)
Uses iconv.internal_encoding. XXX: mode ignored

Parameters:
env -
encoded_header -
mode - controls error recovery
charset - to encode resultant