unicode_globals->to_error_mode = ZEND_CONV_ERROR_STOP;
unicode_globals->conv_error_handler = NULL;
+ {
+ UErrorCode status = U_ZERO_ERROR;
+
+ unicode_globals->root_collator = ucol_open("en_US", &status);
+ ucol_setStrength(unicode_globals->root_collator, UCOL_PRIMARY);
+ unicode_globals->root_search = usearch_openFromCollator(EMPTY_STR, 1, EMPTY_STR, 1,
+ unicode_globals->root_collator, NULL, &status);
+ }
+
zend_hash_init_ex(&unicode_globals->flex_compatible, 0, NULL, NULL, 1, 0);
}
static void unicode_globals_dtor(zend_unicode_globals *unicode_globals TSRMLS_DC)
{
+ if (unicode_globals->root_collator) {
+ ucol_close(unicode_globals->root_collator);
+ }
+ if (unicode_globals->root_search) {
+ usearch_close(unicode_globals->root_search);
+ }
if (unicode_globals->fallback_encoding_conv) {
ucnv_close(unicode_globals->fallback_encoding_conv);
}
#include <unicode/ucnv.h>
#include <unicode/ucol.h>
+#include <unicode/usearch.h>
/* Define ZTS if you want a thread-safe Zend */
/*#undef ZTS*/
char *default_locale;
zend_collator *default_collator;
+ UCollator *root_collator;
+ UStringSearch *root_search;
HashTable flex_compatible; /* table of flex-compatible encodings */
while (1) {
*status = U_ZERO_ERROR;
buffer = eurealloc(buffer, buffer_len+1);
- buffer_len = u_strFoldCase(buffer, buffer_len+1, src, src_len, options, status);
+ buffer_len = u_strFoldCase(buffer, buffer_len, src, src_len, options, status);
if (*status != U_BUFFER_OVERFLOW_ERROR) {
break;
}