Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StringLength.php
Go to the documentation of this file.
1 <?php
9 
10 class StringLength extends \Zend_Validate_StringLength implements \Magento\Framework\Validator\ValidatorInterface
11 {
15  protected $_encoding = 'UTF-8';
16 
20  public function setEncoding($encoding = null)
21  {
22  if ($encoding !== null) {
23  $orig = ini_get('default_charset');
24  ini_set('default_charset', $encoding);
25  if (!ini_get('default_charset')) {
26  throw new \Zend_Validate_Exception('Given encoding not supported on this OS!');
27  }
28  ini_set('default_charset', $orig);
29  }
30 
31  $this->_encoding = $encoding;
32  return $this;
33  }
34 }
ini_set($varName, $newValue)