File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
lib/internal/Magento/Framework/Validator Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,35 @@ class StringLength extends \Zend_Validate_StringLength implements \Magento\Frame
13
13
* @var string
14
14
*/
15
15
protected $ _encoding = 'UTF-8 ' ;
16
+
17
+ /**
18
+ * {@inheritdoc}
19
+ */
20
+ public function setEncoding ($ encoding = null )
21
+ {
22
+ if ($ encoding !== null ) {
23
+ $ orig = PHP_VERSION_ID < 50600
24
+ ? iconv_get_encoding ('internal_encoding ' )
25
+ : ini_get ('default_charset ' );
26
+ if (PHP_VERSION_ID < 50600 ) {
27
+ $ result = iconv_set_encoding ('internal_encoding ' , $ encoding );
28
+ } else {
29
+ ini_set ('default_charset ' , $ encoding );
30
+ $ result = ini_get ('default_charset ' );
31
+ }
32
+ if (!$ result ) {
33
+ #require_once 'Zend/Validate/Exception.php';
34
+ throw new Zend_Validate_Exception ('Given encoding not supported on this OS! ' );
35
+ }
36
+
37
+ if (PHP_VERSION_ID < 50600 ) {
38
+ iconv_set_encoding ('internal_encoding ' , $ orig );
39
+ } else {
40
+ ini_set ('default_charset ' , $ orig );
41
+ }
42
+ }
43
+
44
+ $ this ->_encoding = $ encoding ;
45
+ return $ this ;
46
+ }
16
47
}
You can’t perform that action at this time.
0 commit comments