1--TEST--
2Test mb_encode_mimeheader() function : basic functionality
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7/*
8 * Test mb_encode_header() with different strings
9 */
10
11echo "*** Testing mb_encode_mimeheader() : basic2 ***\n";
12
13//All strings are the same when displayed in their respective encodings
14$sjis_string = base64_decode('k/qWe4zqg2WDTINYg2eCxYK3gUIwMTIzNIJUglWCVoJXgliBQg==');
15$jis_string = base64_decode('GyRCRnxLXDhsJUYlLSU5JUgkRyQ5ISMbKEIwMTIzNBskQiM1IzYjNyM4IzkhIxsoQg==');
16$euc_jp_string = base64_decode('xvzL3LjspcalraW5pcikx6S5oaMwMTIzNKO1o7ajt6O4o7mhow==');
17
18$inputs = array('SJIS' => $sjis_string,
19                'JIS' => $jis_string,
20                'EUC_JP' => $euc_jp_string);
21
22foreach ($inputs as $lang => $input) {
23    echo "\nLanguage: $lang\n";
24    echo "-- Base 64: --\n";
25    mb_internal_encoding($lang);
26    $outEncoding = "UTF-8";
27    var_dump(mb_encode_mimeheader($input, $outEncoding, 'B'));
28    echo "-- Quoted-Printable --\n";
29    var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q'));
30}
31
32echo "Done";
33?>
34--EXPECT--
35*** Testing mb_encode_mimeheader() : basic2 ***
36
37Language: SJIS
38-- Base 64: --
39string(99) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJc=?=
40 =?UTF-8?B?77yY77yZ44CC?="
41-- Quoted-Printable --
42string(201) "=?UTF-8?Q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?=
43 =?UTF-8?Q?=E3=81=A7=E3=81=99=E3=80=82=30=31=32=33=34=EF=BC=95=EF=BC=96?=
44 =?UTF-8?Q?=EF=BC=97=EF=BC=98=EF=BC=99=E3=80=82?="
45
46Language: JIS
47-- Base 64: --
48string(99) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJc=?=
49 =?UTF-8?B?77yY77yZ44CC?="
50-- Quoted-Printable --
51string(201) "=?UTF-8?Q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?=
52 =?UTF-8?Q?=E3=81=A7=E3=81=99=E3=80=82=30=31=32=33=34=EF=BC=95=EF=BC=96?=
53 =?UTF-8?Q?=EF=BC=97=EF=BC=98=EF=BC=99=E3=80=82?="
54
55Language: EUC_JP
56-- Base 64: --
57string(99) "=?UTF-8?B?5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJc=?=
58 =?UTF-8?B?77yY77yZ44CC?="
59-- Quoted-Printable --
60string(201) "=?UTF-8?Q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?=
61 =?UTF-8?Q?=E3=81=A7=E3=81=99=E3=80=82=30=31=32=33=34=EF=BC=95=EF=BC=96?=
62 =?UTF-8?Q?=EF=BC=97=EF=BC=98=EF=BC=99=E3=80=82?="
63Done
64