original_string: public function charset($charset, $convert = true)
      {
          $oldcharset = $this->_charset;
          $this->_charset = Horde_String::upper($charset);
  
          if (!$convert || ($oldcharset == $this->_charset)) {
              return;
          }
  
          foreach (array('and', 'or') as $item) {
              if (isset($this->_search[$item])) {
                  foreach ($this->_search[$item] as &$val) {
                      $val->charset($charset, $convert);
                  }
              }
          }
  
          foreach (array('header', 'text') as $item) {
              if (isset($this->_search[$item])) {
                  foreach ($this->_search[$item] as $key => $val) {
                      $new_val = Horde_String::convertCharset($val['text'], $oldcharset, $this->_charset);
                      if (Horde_String::convertCharset($new_val, $this->_charset, $oldcharset) != $val['text']) {
                          throw new Horde_Imap_Client_Exception_SearchCharset($this->_charset);
                      }
                      $this->_search[$item][$key]['text'] = $new_val;
                  }
              }
          }
      }
code: public function charset($charset, $convert = true)
      {
          $oldcharset = $this->_charset;
          $this->_charset = Horde_String::upper($charset);
  
          if (!$convert || ($oldcharset == $this->_charset)) {
              return;
          }
  
          foreach (array('and', 'or') as $item) {
              if (isset($this->_search[$item])) {
                  foreach ($this->_search[$item] as &$val) {
                      $val->charset($charset, $convert);
                  }
              }
          }
  
          foreach (array('header', 'text') as $item) {
              if (isset($this->_search[$item])) {
                  foreach ($this->_search[$item] as $key => $val) {
                      $new_val = Horde_String::convertCharset($val['text'], $oldcharset, $this->_charset);
                      if (Horde_String::convertCharset($new_val, $this->_charset, $oldcharset) != $val['text']) {
                          throw new Horde_Imap_Client_Exception_SearchCharset($this->_charset);
                      }
                      $this->_search[$item][$key]['text'] = $new_val;
                  }
              }
          }
      }
code_tokens: public function charset ( $ charset , $ convert = true ) { $ oldcharset = $ this -> _charset ; $ this -> _charset = Horde_String :: upper ( $ charset ) ; if ( ! $ convert || ( $ oldcharset == $ this -> _charset ) ) { return ; } foreach ( array ( 'and' , 'or' ) as $ item ) { if ( isset ( $ this -> _search [ $ item ] ) ) { foreach ( $ this -> _search [ $ item ] as & $ val ) { $ val -> charset ( $ charset , $ convert ) ; } } } foreach ( array ( 'header' , 'text' ) as $ item ) { if ( isset ( $ this -> _search [ $ item ] ) ) { foreach ( $ this -> _search [ $ item ] as $ key => $ val ) { $ new_val = Horde_String :: convertCharset ( $ val [ 'text' ] , $ oldcharset , $ this -> _charset ) ; if ( Horde_String :: convertCharset ( $ new_val , $ this -> _charset , $ oldcharset ) != $ val [ 'text' ] ) { throw new Horde_Imap_Client_Exception_SearchCharset ( $ this -> _charset ) ; } $ this -> _search [ $ item ] [ $ key ] [ 'text' ] = $ new_val ; } } } }
docstring: Sets the charset of the search text.
  
  @param string $charset   The charset to use for the search.
  @param boolean $convert  Convert existing text values?
  
  @throws Horde_Imap_Client_Exception_SearchCharset
docstring_tokens: Sets the charset of the search text .