Commit Graph

20 Commits

Author SHA1 Message Date
Andrei Zmievski
16c55fb25a Move to refcounted implementation of collators. 2006-04-20 21:56:43 +00:00
Sara Golemon
30a2bd1d11 Another (and hopefully last) major streams commit.
This moves unicode conversion to the filter layer
(rather than at the lower streams layer)
unicode_filter.c has been moved from ext/unicode to main/streams
as it's an integral part of the streams unicode conversion process.

There are now three ways to set encoding on a stream:

(1) By context
$ctx = stream_context_create(NULL,array('encoding'=>'latin1'));
$fp = fopen('somefile', 'r+t', false, $ctx);

(2) By stream_encoding()
$fp = fopen('somefile', 'r+');
stream_encoding($fp, 'latin1');

(3) By filter
$fp = fopen('somefile', 'r+');
stream_filter_append($fp, 'unicode.from.latin1', STREAM_FILTER_READ);
stream_filter_append($fp, 'unicode.to.latin1', STREAM_FILTER_WRITE);

Note: Methods 1 and 2 are convenience wrappers around method 3.
2006-03-29 01:20:43 +00:00
Andrei Zmievski
b36d2dfef6 Rewrite unicode_encode() and unicode_decode() functions. Apply the new
conversion error semantics.
2006-03-27 03:19:30 +00:00
Andrei Zmievski
db50082fe9 Add unicode_get_error_mode() and unicode_get_subst_char(). 2006-03-26 21:22:59 +00:00
Derick Rethans
ad6a972de3 - Implemented basic collation support. For some reason "new Collator" gives segfaults when the object's collation resource is used.
- The following example shows what is implemented:

<?php
$orig = $strings = array(
    'côte',
    'cote',
    'côté',
    'coté',
    'fluße',
    'flüße',
);

echo "German phonebook:\n";
$c = collator_create( "de@collation=phonebook" );
foreach($c->sort($strings) as $string) {
    echo $string, "\n";
}
echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
    ? "With" : "Without", " french accent sorting order\n";

echo "\nFrench with options:\n";
$c = collator_create( "fr" );
$c->setAttribute(Collator::CASE_FIRST, Collator::UPPER_FIRST);
$c->setAttribute(Collator::CASE_LEVEL, Collator::ON);
$c->setStrength(Collator::SECONDARY);
foreach($c->sort($strings) as $string) {
    echo $string, "\n";
}
echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
    ? "With" : "Without", " french accent sorting order\n";
?>
2006-03-26 11:06:24 +00:00
Andrei Zmievski
1709428494 Implement to-Unicode conversion error behavior. Note the adjusted APIs. 2006-03-26 06:19:24 +00:00
Andrei Zmievski
c254b21cca Add protos. 2006-03-26 03:33:10 +00:00
Andrei Zmievski
930bde5897 * Remove unicode.from_error_mode and unicode.from_subst_char from INI
settings.
* Add unicode_set_error_mode() and unicode_set_subst_char() functions to
  manipulate these global settings.
2006-03-26 01:48:33 +00:00
Derick Rethans
3056defb26 - Moved strtotitle to ext/standard and implemented the fallback case to
non-unicode with ucwords. There is also an implementation for unicode ucwords
  but that returns different results then strtotitle as it uppercases the
  first character of every word, and doesn't *titlecase* a word. The test case
  shows that.
2006-03-22 10:20:20 +00:00
Dmitry Stogov
c366cc6d1a Nuke int32_t (everywhere except streams layer) and signed/unsigned warnings 2006-03-02 13:12:45 +00:00
Marcus Boerger
4e172c21a5 - Change unicode_enabled() to unicode_semantics() per Andrei's suggestion 2006-02-13 19:55:17 +00:00
Marcus Boerger
83f1271312 - Add unicode_enabled() to check whether unicode_semantics is on 2006-02-13 09:20:19 +00:00
Andrei Zmievski
d4c929764a Proof-of-concept for TextIterator. Much more work to be done here. 2006-02-01 23:50:50 +00:00
foobar
251c5173fd bump year and license version 2006-01-01 13:10:10 +00:00
foobar
a208d9a966 - Nuke php3 legacy 2005-12-06 02:28:26 +00:00
Derick Rethans
6e3d5a9e22 - Rename icu_loc* to i18n_loc*
- Added i18n_strtotitle (name is not sure yet) - work in progress.
2005-09-14 14:56:01 +00:00
foobar
4414846b18 fix protos 2005-08-14 02:03:02 +00:00
Wez Furlong
57ae2f99b7 Fixup config.w32.
Implement unicode_decode() and unicode_encode(), as described in README.UNICODE.

Still need to decide how to handle errors here, since there is no error return,
and a conversion error is not necessarily fatal.
2005-08-13 13:43:31 +00:00
foobar
3ed4aee952 - Some minor fixes 2005-08-12 09:10:04 +00:00
Andrei Zmievski
264cec8be6 Unicode support. 2005-08-11 23:36:07 +00:00