1--TEST-- 2iconv_mime_encode() 3--EXTENSIONS-- 4iconv 5--INI-- 6iconv.internal_charset=iso-8859-1 7--FILE-- 8<?php 9function my_error_handler($errno, $errmsg, $filename, $linenum) 10{ 11 echo "$errno: $errmsg\n"; 12} 13set_error_handler('my_error_handler'); 14$preference = array( 15 "scheme" => "B", 16 "output-charset" => "ISO-2022-JP", 17 "input-charset" => "EUC-JP", 18 "line-break-chars" => "\n" 19); 20for ($line_len= 0; $line_len < 80; ++$line_len) { 21 print "-------- line length=$line_len\n"; 22 $preference["line-length"] = $line_len; 23 $result = iconv_mime_encode("From", "����ץ�ʸ����ץ�ʸ�������ܸ�ƥ�����", $preference); 24 var_dump($result); 25 if ($result !== false) { 26 $max = max(array_map("strlen", explode("\n", $result))); 27 print "-------- "; 28 var_dump(($max <= $line_len)); 29 } else { 30 print "-------- \n"; 31 } 32} 33?> 34--EXPECTF-- 35-------- line length=0 362: %s 37bool(false) 38-------- 39-------- line length=1 402: %s 41bool(false) 42-------- 43-------- line length=2 442: %s 45bool(false) 46-------- 47-------- line length=3 482: %s 49bool(false) 50-------- 51-------- line length=4 522: %s 53bool(false) 54-------- 55-------- line length=5 562: %s 57bool(false) 58-------- 59-------- line length=6 602: %s 61bool(false) 62-------- 63-------- line length=7 642: %s 65bool(false) 66-------- 67-------- line length=8 682: %s 69bool(false) 70-------- 71-------- line length=9 722: %s 73bool(false) 74-------- 75-------- line length=10 762: %s 77bool(false) 78-------- 79-------- line length=11 802: %s 81bool(false) 82-------- 83-------- line length=12 842: %s 85bool(false) 86-------- 87-------- line length=13 882: %s 89bool(false) 90-------- 91-------- line length=14 922: %s 93bool(false) 94-------- 95-------- line length=15 962: %s 97bool(false) 98-------- 99-------- line length=16 1002: %s 101bool(false) 102-------- 103-------- line length=17 1042: %s 105bool(false) 106-------- 107-------- line length=18 1082: %s 109bool(false) 110-------- 111-------- line length=19 1122: %s 113bool(false) 114-------- 115-------- line length=20 1162: %s 117bool(false) 118-------- 119-------- line length=21 1202: %s 121bool(false) 122-------- 123-------- line length=22 1242: %s 125bool(false) 126-------- 127-------- line length=23 1282: %s 129bool(false) 130-------- 131-------- line length=24 1322: %s 133bool(false) 134-------- 135-------- line length=25 1362: %s 137bool(false) 138-------- 139-------- line length=26 1402: %s 141bool(false) 142-------- 143-------- line length=27 1442: %s 145bool(false) 146-------- 147-------- line length=28 1482: %s 149bool(false) 150-------- 151-------- line length=29 1522: %s 153bool(false) 154-------- 155-------- line length=30 1562: %s 157bool(false) 158-------- 159-------- line length=31 1602: %s 161bool(false) 162-------- 163-------- line length=32 1642: %s 165bool(false) 166-------- 167-------- line length=33 1682: %s 169bool(false) 170-------- 171-------- line length=34 1722: %s 173bool(false) 174-------- 175-------- line length=35 1762: %s 177bool(false) 178-------- 179-------- line length=36 180string(396) "From: =?ISO-2022-JP?B?GyRCJTUbKEI=?= 181 =?ISO-2022-JP?B?GyRCJXMlVxsoQg==?= 182 =?ISO-2022-JP?B?GyRCJWtKOBsoQg==?= 183 =?ISO-2022-JP?B?GyRCO3pOcxsoQg==?= 184 =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?= 185 =?ISO-2022-JP?B?GyRCJVclaxsoQg==?= 186 =?ISO-2022-JP?B?GyRCSjg7ehsoQg==?= 187 =?ISO-2022-JP?B?GyRCTnNGfBsoQg==?= 188 =?ISO-2022-JP?B?GyRCS1w4bBsoQg==?= 189 =?ISO-2022-JP?B?GyRCJUYlLRsoQg==?= 190 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 191-------- bool(true) 192-------- line length=37 193string(396) "From: =?ISO-2022-JP?B?GyRCJTUbKEI=?= 194 =?ISO-2022-JP?B?GyRCJXMlVxsoQg==?= 195 =?ISO-2022-JP?B?GyRCJWtKOBsoQg==?= 196 =?ISO-2022-JP?B?GyRCO3pOcxsoQg==?= 197 =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?= 198 =?ISO-2022-JP?B?GyRCJVclaxsoQg==?= 199 =?ISO-2022-JP?B?GyRCSjg7ehsoQg==?= 200 =?ISO-2022-JP?B?GyRCTnNGfBsoQg==?= 201 =?ISO-2022-JP?B?GyRCS1w4bBsoQg==?= 202 =?ISO-2022-JP?B?GyRCJUYlLRsoQg==?= 203 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 204-------- bool(true) 205-------- line length=38 206string(396) "From: =?ISO-2022-JP?B?GyRCJTUbKEI=?= 207 =?ISO-2022-JP?B?GyRCJXMlVxsoQg==?= 208 =?ISO-2022-JP?B?GyRCJWtKOBsoQg==?= 209 =?ISO-2022-JP?B?GyRCO3pOcxsoQg==?= 210 =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?= 211 =?ISO-2022-JP?B?GyRCJVclaxsoQg==?= 212 =?ISO-2022-JP?B?GyRCSjg7ehsoQg==?= 213 =?ISO-2022-JP?B?GyRCTnNGfBsoQg==?= 214 =?ISO-2022-JP?B?GyRCS1w4bBsoQg==?= 215 =?ISO-2022-JP?B?GyRCJUYlLRsoQg==?= 216 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 217-------- bool(true) 218-------- line length=39 219string(236) "From: =?ISO-2022-JP?B?GyRCJTUbKEI=?= 220 =?ISO-2022-JP?B?GyRCJXMlVyVrSjgbKEI=?= 221 =?ISO-2022-JP?B?GyRCO3pOcyU1JXMbKEI=?= 222 =?ISO-2022-JP?B?GyRCJVcla0o4O3obKEI=?= 223 =?ISO-2022-JP?B?GyRCTnNGfEtcOGwbKEI=?= 224 =?ISO-2022-JP?B?GyRCJUYlLSU5JUgbKEI=?=" 225-------- bool(true) 226-------- line length=40 227string(236) "From: =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?= 228 =?ISO-2022-JP?B?GyRCJVcla0o4O3obKEI=?= 229 =?ISO-2022-JP?B?GyRCTnMlNSVzJVcbKEI=?= 230 =?ISO-2022-JP?B?GyRCJWtKODt6TnMbKEI=?= 231 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYbKEI=?= 232 =?ISO-2022-JP?B?GyRCJS0lOSVIGyhC?=" 233-------- bool(true) 234-------- line length=41 235string(236) "From: =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?= 236 =?ISO-2022-JP?B?GyRCJVcla0o4O3obKEI=?= 237 =?ISO-2022-JP?B?GyRCTnMlNSVzJVcbKEI=?= 238 =?ISO-2022-JP?B?GyRCJWtKODt6TnMbKEI=?= 239 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYbKEI=?= 240 =?ISO-2022-JP?B?GyRCJS0lOSVIGyhC?=" 241-------- bool(true) 242-------- line length=42 243string(236) "From: =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?= 244 =?ISO-2022-JP?B?GyRCJVcla0o4O3obKEI=?= 245 =?ISO-2022-JP?B?GyRCTnMlNSVzJVcbKEI=?= 246 =?ISO-2022-JP?B?GyRCJWtKODt6TnMbKEI=?= 247 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYbKEI=?= 248 =?ISO-2022-JP?B?GyRCJS0lOSVIGyhC?=" 249-------- bool(true) 250-------- line length=43 251string(212) "From: =?ISO-2022-JP?B?GyRCJTUlcxsoQg==?= 252 =?ISO-2022-JP?B?GyRCJVcla0o4O3pOcxsoQg==?= 253 =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKOBsoQg==?= 254 =?ISO-2022-JP?B?GyRCO3pOc0Z8S1w4bBsoQg==?= 255 =?ISO-2022-JP?B?GyRCJUYlLSU5JUgbKEI=?=" 256-------- bool(true) 257-------- line length=44 258string(212) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWsbKEI=?= 259 =?ISO-2022-JP?B?GyRCSjg7ek5zJTUlcxsoQg==?= 260 =?ISO-2022-JP?B?GyRCJVcla0o4O3pOcxsoQg==?= 261 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYlLRsoQg==?= 262 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 263-------- bool(true) 264-------- line length=45 265string(212) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWsbKEI=?= 266 =?ISO-2022-JP?B?GyRCSjg7ek5zJTUlcxsoQg==?= 267 =?ISO-2022-JP?B?GyRCJVcla0o4O3pOcxsoQg==?= 268 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYlLRsoQg==?= 269 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 270-------- bool(true) 271-------- line length=46 272string(212) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWsbKEI=?= 273 =?ISO-2022-JP?B?GyRCSjg7ek5zJTUlcxsoQg==?= 274 =?ISO-2022-JP?B?GyRCJVcla0o4O3pOcxsoQg==?= 275 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYlLRsoQg==?= 276 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 277-------- bool(true) 278-------- line length=47 279string(176) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWsbKEI=?= 280 =?ISO-2022-JP?B?GyRCSjg7ek5zJTUlcyVXJWsbKEI=?= 281 =?ISO-2022-JP?B?GyRCSjg7ek5zRnxLXDhsJUYbKEI=?= 282 =?ISO-2022-JP?B?GyRCJS0lOSVIGyhC?=" 283-------- bool(true) 284-------- line length=48 285string(180) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKOBsoQg==?= 286 =?ISO-2022-JP?B?GyRCO3pOcyU1JXMlVyVrSjgbKEI=?= 287 =?ISO-2022-JP?B?GyRCO3pOc0Z8S1w4bCVGJS0bKEI=?= 288 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 289-------- bool(true) 290-------- line length=49 291string(180) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKOBsoQg==?= 292 =?ISO-2022-JP?B?GyRCO3pOcyU1JXMlVyVrSjgbKEI=?= 293 =?ISO-2022-JP?B?GyRCO3pOc0Z8S1w4bCVGJS0bKEI=?= 294 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 295-------- bool(true) 296-------- line length=50 297string(180) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKOBsoQg==?= 298 =?ISO-2022-JP?B?GyRCO3pOcyU1JXMlVyVrSjgbKEI=?= 299 =?ISO-2022-JP?B?GyRCO3pOc0Z8S1w4bCVGJS0bKEI=?= 300 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 301-------- bool(true) 302-------- line length=51 303string(152) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKOBsoQg==?= 304 =?ISO-2022-JP?B?GyRCO3pOcyU1JXMlVyVrSjg7ehsoQg==?= 305 =?ISO-2022-JP?B?GyRCTnNGfEtcOGwlRiUtJTklSBsoQg==?=" 306-------- bool(true) 307-------- line length=52 308string(148) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMbKEI=?= 309 =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnNGfBsoQg==?= 310 =?ISO-2022-JP?B?GyRCS1w4bCVGJS0lOSVIGyhC?=" 311-------- bool(true) 312-------- line length=53 313string(148) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMbKEI=?= 314 =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnNGfBsoQg==?= 315 =?ISO-2022-JP?B?GyRCS1w4bCVGJS0lOSVIGyhC?=" 316-------- bool(true) 317-------- line length=54 318string(148) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMbKEI=?= 319 =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnNGfBsoQg==?= 320 =?ISO-2022-JP?B?GyRCS1w4bCVGJS0lOSVIGyhC?=" 321-------- bool(true) 322-------- line length=55 323string(148) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMbKEI=?= 324 =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnNGfEtcOGwbKEI=?= 325 =?ISO-2022-JP?B?GyRCJUYlLSU5JUgbKEI=?=" 326-------- bool(true) 327-------- line length=56 328string(148) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNRsoQg==?= 329 =?ISO-2022-JP?B?GyRCJXMlVyVrSjg7ek5zRnxLXDhsJUYbKEI=?= 330 =?ISO-2022-JP?B?GyRCJS0lOSVIGyhC?=" 331-------- bool(true) 332-------- line length=57 333string(148) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNRsoQg==?= 334 =?ISO-2022-JP?B?GyRCJXMlVyVrSjg7ek5zRnxLXDhsJUYbKEI=?= 335 =?ISO-2022-JP?B?GyRCJS0lOSVIGyhC?=" 336-------- bool(true) 337-------- line length=58 338string(148) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNRsoQg==?= 339 =?ISO-2022-JP?B?GyRCJXMlVyVrSjg7ek5zRnxLXDhsJUYbKEI=?= 340 =?ISO-2022-JP?B?GyRCJS0lOSVIGyhC?=" 341-------- bool(true) 342-------- line length=59 343string(152) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNRsoQg==?= 344 =?ISO-2022-JP?B?GyRCJXMlVyVrSjg7ek5zRnxLXDhsJUYlLRsoQg==?= 345 =?ISO-2022-JP?B?GyRCJTklSBsoQg==?=" 346-------- bool(true) 347-------- line length=60 348string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcbKEI=?= 349 =?ISO-2022-JP?B?GyRCJWtKODt6TnNGfEtcOGwlRiUtJTklSBsoQg==?=" 350-------- bool(true) 351-------- line length=61 352string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcbKEI=?= 353 =?ISO-2022-JP?B?GyRCJWtKODt6TnNGfEtcOGwlRiUtJTklSBsoQg==?=" 354-------- bool(true) 355-------- line length=62 356string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcbKEI=?= 357 =?ISO-2022-JP?B?GyRCJWtKODt6TnNGfEtcOGwlRiUtJTklSBsoQg==?=" 358-------- bool(true) 359-------- line length=63 360string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcbKEI=?= 361 =?ISO-2022-JP?B?GyRCJWtKODt6TnNGfEtcOGwlRiUtJTklSBsoQg==?=" 362-------- bool(true) 363-------- line length=64 364string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVclaxsoQg==?= 365 =?ISO-2022-JP?B?GyRCSjg7ek5zRnxLXDhsJUYlLSU5JUgbKEI=?=" 366-------- bool(true) 367-------- line length=65 368string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVclaxsoQg==?= 369 =?ISO-2022-JP?B?GyRCSjg7ek5zRnxLXDhsJUYlLSU5JUgbKEI=?=" 370-------- bool(true) 371-------- line length=66 372string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVclaxsoQg==?= 373 =?ISO-2022-JP?B?GyRCSjg7ek5zRnxLXDhsJUYlLSU5JUgbKEI=?=" 374-------- bool(true) 375-------- line length=67 376string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVclaxsoQg==?= 377 =?ISO-2022-JP?B?GyRCSjg7ek5zRnxLXDhsJUYlLSU5JUgbKEI=?=" 378-------- bool(true) 379-------- line length=68 380string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3obKEI=?= 381 =?ISO-2022-JP?B?GyRCTnNGfEtcOGwlRiUtJTklSBsoQg==?=" 382-------- bool(true) 383-------- line length=69 384string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3obKEI=?= 385 =?ISO-2022-JP?B?GyRCTnNGfEtcOGwlRiUtJTklSBsoQg==?=" 386-------- bool(true) 387-------- line length=70 388string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3obKEI=?= 389 =?ISO-2022-JP?B?GyRCTnNGfEtcOGwlRiUtJTklSBsoQg==?=" 390-------- bool(true) 391-------- line length=71 392string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3obKEI=?= 393 =?ISO-2022-JP?B?GyRCTnNGfEtcOGwlRiUtJTklSBsoQg==?=" 394-------- bool(true) 395-------- line length=72 396string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOcxsoQg==?= 397 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYlLSU5JUgbKEI=?=" 398-------- bool(true) 399-------- line length=73 400string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOcxsoQg==?= 401 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYlLSU5JUgbKEI=?=" 402-------- bool(true) 403-------- line length=74 404string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOcxsoQg==?= 405 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYlLSU5JUgbKEI=?=" 406-------- bool(true) 407-------- line length=75 408string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOcxsoQg==?= 409 =?ISO-2022-JP?B?GyRCRnxLXDhsJUYlLSU5JUgbKEI=?=" 410-------- bool(true) 411-------- line length=76 412string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOc0Z8S1wbKEI=?= 413 =?ISO-2022-JP?B?GyRCOGwlRiUtJTklSBsoQg==?=" 414-------- bool(true) 415-------- line length=77 416string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOc0Z8S1wbKEI=?= 417 =?ISO-2022-JP?B?GyRCOGwlRiUtJTklSBsoQg==?=" 418-------- bool(true) 419-------- line length=78 420string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOc0Z8S1wbKEI=?= 421 =?ISO-2022-JP?B?GyRCOGwlRiUtJTklSBsoQg==?=" 422-------- bool(true) 423-------- line length=79 424string(120) "From: =?ISO-2022-JP?B?GyRCJTUlcyVXJWtKODt6TnMlNSVzJVcla0o4O3pOc0Z8S1wbKEI=?= 425 =?ISO-2022-JP?B?GyRCOGwlRiUtJTklSBsoQg==?=" 426-------- bool(true) 427