summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2005-02-21 07:45:38 +0000
committerSVN Migration <svn@php.net>2005-02-21 07:45:38 +0000
commitdd21c3fd8d2df80f39d6fcc2b6550b93a5d0131f (patch)
treed9e5ca62f4fd9d16dbd42146ae2884cff4dc44a7
parentebc27e8dce3ab3c486875fe0fabd780ccfa0d167 (diff)
downloadphp-git-dd21c3fd8d2df80f39d6fcc2b6550b93a5d0131f.tar.gz
This commit was manufactured by cvs2svn to create branch 'PHP_4_3'.
-rw-r--r--ext/mbstring/tests/bug28220.phpt23
-rw-r--r--ext/mbstring/tests/bug30549.phpt29
2 files changed, 52 insertions, 0 deletions
diff --git a/ext/mbstring/tests/bug28220.phpt b/ext/mbstring/tests/bug28220.phpt
new file mode 100644
index 0000000000..563e2da743
--- /dev/null
+++ b/ext/mbstring/tests/bug28220.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #28220 (mb_strwidth() returns wrong width values for some Hangul characters)
+--FILE--
+<?php
+$coderange = array(
+ range(0x0000, 0x1fff),
+ range(0xff60, 0xff9f)
+);
+
+
+foreach ($coderange as $r) {
+ $ng = 0;
+ foreach ($r as $c) {
+ if (mb_strwidth(pack('N1', $c), 'UCS-4BE') != 2) {
+ $ng++;
+ }
+ }
+ echo "$ng\n";
+}
+?>
+--EXPECT--
+8101
+63
diff --git a/ext/mbstring/tests/bug30549.phpt b/ext/mbstring/tests/bug30549.phpt
new file mode 100644
index 0000000000..dbd8e0bd19
--- /dev/null
+++ b/ext/mbstring/tests/bug30549.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #30549 (incorrect character translations for some ISO8859 charsets)
+--FILE--
+<?php
+test('ISO-8859-7', array(0xa4 => 0x20ac, 0xa5 => 0x20af, 0xaa => 0x037a));
+test('ISO-8859-8', array(0xaf => 0x00af, 0xfd => 0x200e, 0xfe => 0x200f));
+test('ISO-8859-10', array(0xa4 => 0x012a ));
+
+function test($enc, $map) {
+ print "$enc\n";
+
+ foreach($map as $fromc => $toc) {
+ $ustr = mb_convert_encoding(pack('C', $fromc), 'UCS-4BE', $enc);
+ foreach (unpack('Nc', $ustr) as $unic);
+ printf("0x%04x, 0x%04x\n", $toc, $unic);
+ }
+}
+?>
+--EXPECT--
+ISO-8859-7
+0x20ac, 0x20ac
+0x20af, 0x20af
+0x037a, 0x037a
+ISO-8859-8
+0x00af, 0x00af
+0x200e, 0x200e
+0x200f, 0x200f
+ISO-8859-10
+0x012a, 0x012a