HosipLan

Untitled

Jan 26th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1.     /**
  2.      *
  3.      * @param string $document
  4.      * @param string $charset
  5.      *
  6.      * @return string
  7.      */
  8.     public static function fixContentTypeMeta($document, $charset = 'utf-8')
  9.     {
  10.         return Strings::replace($document, // hack for DOMDocument
  11.             '~<meta([^>]+http-equiv\\s*=\\s*)["\']*Content-Type["\']*([^>]+content\\s*=\\s*["\'][^;]+;)[\t ]*charset=[^"\']+(["\'][^>]*)>~i',
  12.             '<meta\\1"Content-Type"\\2 charset=' . $charset . '\\3>'
  13.         );
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment