original_string: function encodeSubject($input, $charset = 'ISO-8859-1')
    {
      // set the internal encoding to the encoding of the given input
      // this way no conversion is done, because we only need the 'Q' encoding
      $old_enc=mb_internal_encoding();
      mb_internal_encoding($charset);
      $output=mb_encode_mimeheader($input,$charset, 'Q', $this->LE);
      // and when ready, restore the internal encoding again
      mb_internal_encoding($old_enc);
      return $output;
      // below is a fallback mechanism which seems to work also
      /*
      preg_match_all('/(\\w*[\\x80-\\xFF]+\\w*)/', $input, $matches);
      foreach ($matches[1] as $value) {
        $replacement = preg_replace('/([\\x80-\\xFF])/e', '"=" . strtoupper(dechex(ord("\\1")))', $value);
        $input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input);
      }
      return $input;
      */
    }
code: function encodeSubject($input, $charset = 'ISO-8859-1')
    {
      // set the internal encoding to the encoding of the given input
      // this way no conversion is done, because we only need the 'Q' encoding
      $old_enc=mb_internal_encoding();
      mb_internal_encoding($charset);
      $output=mb_encode_mimeheader($input,$charset, 'Q', $this->LE);
      // and when ready, restore the internal encoding again
      mb_internal_encoding($old_enc);
      return $output;
      // below is a fallback mechanism which seems to work also
      /*
      preg_match_all('/(\\w*[\\x80-\\xFF]+\\w*)/', $input, $matches);
      foreach ($matches[1] as $value) {
        $replacement = preg_replace('/([\\x80-\\xFF])/e', '"=" . strtoupper(dechex(ord("\\1")))', $value);
        $input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input);
      }
      return $input;
      */
    }
code_tokens: function encodeSubject ( $ input , $ charset = 'ISO-8859-1' ) { // set the internal encoding to the encoding of the given input // this way no conversion is done, because we only need the 'Q' encoding $ old_enc = mb_internal_encoding ( ) ; mb_internal_encoding ( $ charset ) ; $ output = mb_encode_mimeheader ( $ input , $ charset , 'Q' , $ this -> LE ) ; // and when ready, restore the internal encoding again mb_internal_encoding ( $ old_enc ) ; return $ output ; // below is a fallback mechanism which seems to work also /*
      preg_match_all('/(\\w*[\\x80-\\xFF]+\\w*)/', $input, $matches);
      foreach ($matches[1] as $value) {
        $replacement = preg_replace('/([\\x80-\\xFF])/e', '"=" . strtoupper(dechex(ord("\\1")))', $value);
        $input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input);
      }
      return $input;
      */ }
docstring: The method can be used to encode the subject which is
  in a non ascii encoding.
  
  encoding style: =?charset?Q?the encoded text?=
  
  @param string $input
  @param string $charset  eg. UTF-8 or ISO-8859-1
  @return string  the encoded subject
docstring_tokens: The method can be used to encode the subject which is in a non ascii encoding .