Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

StringUtils: MbString wrapper use of 'mb_list_encodings'

  • Loading branch information...
commit 7ba3c5ffb4d6bd8e587abdfbe24266625356faf9 1 parent 954950d
Marc Bennewitz authored November 29, 2012
102  library/Zend/Stdlib/StringWrapper/MbString.php
@@ -23,83 +23,7 @@ class MbString extends AbstractStringWrapper
23 23
      * @var string[]
24 24
      * @link http://php.net/manual/mbstring.supported-encodings.php
25 25
      */
26  
-    protected $encodings = array(
27  
-        'UCS-4',
28  
-        'UCS-4BE',
29  
-        'UCS-4LE',
30  
-        'UCS-2',
31  
-        'UCS-2BE',
32  
-        'UCS-2LE',
33  
-        'UTF-32',
34  
-        'UTF-32BE',
35  
-        'UTF-32LE',
36  
-        'UTF-16',
37  
-        'UTF-16BE',
38  
-        'UTF-16LE',
39  
-        'UTF-7',
40  
-        'UTF7-IMAP',
41  
-        'UTF-8',
42  
-        'ASCII',
43  
-        'EUC-JP',
44  
-        'SJIS',
45  
-        'EUCJP-WIN',
46  
-        'SJIS-WIN',
47  
-        'ISO-2022-JP',
48  
-        'ISO-2022-JP-MS',
49  
-        'CP932',
50  
-        'CP51932',
51  
-        'SJIS-MAC', 'MACJAPANESE',
52  
-        'SJIS-Mobile#DOCOMO', 'SJIS-DOCOMO',
53  
-        'SJIS-Mobile#KDDI', 'SJIS-KDDI',
54  
-        'SJIS-Mobile#SOFTBANK', 'SJIS-SOFTBANK',
55  
-        'UTF-8-Mobile#DOCOMO', 'UTF-8-DOCOMO',
56  
-        'UTF-8-Mobile#KDDI-A',
57  
-        'UTF-8-Mobile#KDDI-B', 'UTF-8-KDDI',
58  
-        'UTF-8-Mobile#SOFTBANK', 'UTF-8-SOFTBANK',
59  
-        'ISO-2022-JP-MOBILE#KDDI', 'ISO-2022-JP-KDDI',
60  
-        'JIS',
61  
-        'JIS-MS',
62  
-        'CP50220',
63  
-        'CP50220RAW',
64  
-        'CP50221',
65  
-        'CP50222',
66  
-        'ISO-8859-1',
67  
-        'ISO-8859-2',
68  
-        'ISO-8859-3',
69  
-        'ISO-8859-4',
70  
-        'ISO-8859-5',
71  
-        'ISO-8859-6',
72  
-        'ISO-8859-7',
73  
-        'ISO-8859-8',
74  
-        'ISO-8859-9',
75  
-        'ISO-8859-10',
76  
-        'ISO-8859-13',
77  
-        'ISO-8859-14',
78  
-        'ISO-8859-15',
79  
-        // 'ISO-8859-16',
80  
-        'bYTE2BE',
81  
-        'bYTE2LE',
82  
-        'BYTE4BE',
83  
-        'BYTE4LE',
84  
-        'BASE64',
85  
-        'HTML-ENTITIES',
86  
-        '7BIT',
87  
-        '8BIT',
88  
-        'EUC-CN',
89  
-        'CP936',
90  
-        'GB18030',
91  
-        'HZ',
92  
-        'EUC-TW',
93  
-        'CP950',
94  
-        'BIG-5',
95  
-        'EUC-KR',
96  
-        'UHC', 'CP949',
97  
-        'ISO-2022-KR',
98  
-        'WINDOWS-1251', 'CP1251',
99  
-        'WINDOWS-1252', 'CP1252',
100  
-        'CP866', 'IBM866',
101  
-        'KOI8-R',
102  
-    );
  26
+    protected $encodings = array();
103 27
 
104 28
     /**
105 29
      * Constructor
@@ -114,29 +38,7 @@ public function __construct()
114 38
             );
115 39
         }
116 40
 
117  
-        // remove encodings not available before PHP-5.4
118  
-        if (version_compare(PHP_VERSION, '5.4', '<')) {
119  
-            unset(
120  
-                $this->encodings['SJIS-MAC'],
121  
-                $this->encodings['MACJAPANESE'],
122  
-                $this->encodings['SJIS-Mobile#DOCOMO'],
123  
-                $this->encodings['SJIS-DOCOMO'],
124  
-                $this->encodings['SJIS-Mobile#KDDI'],
125  
-                $this->encodings['SJIS-KDDI'],
126  
-                $this->encodings['SJIS-Mobile#SOFTBANK'],
127  
-                $this->encodings['SJIS-SOFTBANK'],
128  
-                $this->encodings['UTF-8-Mobile#DOCOMO'],
129  
-                $this->encodings['UTF-8-DOCOMO'],
130  
-                $this->encodings['UTF-8-Mobile#KDDI-A'],
131  
-                $this->encodings['UTF-8-Mobile#KDDI-B'],
132  
-                $this->encodings['UTF-8-KDDI'],
133  
-                $this->encodings['UTF-8-Mobile#SOFTBANK'],
134  
-                $this->encodings['UTF-8-SOFTBANK'],
135  
-                $this->encodings['ISO-2022-JP-MOBILE#KDDI'],
136  
-                $this->encodings['ISO-2022-JP-KDDI'],
137  
-                $this->encodings['GB18030']
138  
-            );
139  
-        }
  41
+        $this->encodings = array_map('strtoupper', mb_list_encodings());
140 42
     }
141 43
 
142 44
     /**

0 notes on commit 7ba3c5f

Please sign in to comment.
Something went wrong with that request. Please try again.