Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have almost identical state like you , </p> <p>development machine is windows + php 5.3 </p> <p>development machine is Linux + php 5.2.14 </p> <p>ZF version is 1.10</p> <p>the only difference i had is : i used to add <code>mb_internal_encoding("UTF-8");</code> in the bootstrap class </p> <p>FYI , I used to cache text (arabic language ) from database all encoded UTF8 when i open the file i see the arabic text as expected .</p> <p><strong>UPDATE</strong> : 1- here is my complete initCache function just to make it clear </p> <pre><code>public function _initCache() { mb_internal_encoding("UTF-8"); $frontendOptions = array( 'automatic_serialization' =&gt; TRUE, 'lifetime' =&gt; 86400 ); $backendOptions = array( 'cache_dir' =&gt; APPLICATION_PATH . "/configs/cache/", ///'cache_dir' =&gt; sys_get_temp_dir(), ); $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); Zend_Db_Table_Abstract::setDefaultMetadataCache($cache); Zend_Registry::set("cache", $cache); } </code></pre> <p><strong>Explanation :</strong> 1-Any php version earlier than PHP 6 doesn't have native support for UTF-8 , <a href="https://stackoverflow.com/questions/716703/what-is-coming-in-php-6">https://stackoverflow.com/questions/716703/what-is-coming-in-php-6</a> </p> <p>2-making php 5.3 or 5.2 deal with UTF8 by using <a href="http://php.net/manual/en/book.iconv.php" rel="nofollow noreferrer">ICONV</a> or <a href="http://php.net/manual/en/book.mbstring.php" rel="nofollow noreferrer">MB_STRING</a></p> <p>simply by using <code>var_dump(mb_internal_encoding());</code></p> <p>you can tell that php using <strong>ISO-8859-1</strong> internally ,</p> <p>you can override it by <code>var_dump(mb_internal_encoding("UTF-8"));</code> </p> <p>it would output true (it success to override the internal encoding )</p> <p>to be honest i don't know if there is better solution or <a href="https://stackoverflow.com/questions/4045060/how-bad-is-mb-internal-encodingutf-8">how bad it is ??</a> ,</p> <p>if you had any better i would be happy to adopt it :) </p> <p><strong>UPDATE 2</strong> in case you don't want to use that function , open this file <code>"Zend/Cache/Backend/File.php"</code> and go to the line 976 change this : </p> <pre><code>protected function _filePutContents($file, $string) { $result = false; $f = @fopen($file, 'ab+'); if ($f) { if ($this-&gt;_options['file_locking']) @flock($f, LOCK_EX); fseek($f, 0); ftruncate($f, 0); $tmp = @fwrite($f, $string); if (!($tmp === FALSE)) { $result = true; } @fclose($f); } @chmod($file, $this-&gt;_options['cache_file_umask']); return $result; } </code></pre> <p>to be this : </p> <pre><code>protected function _filePutContents($file, $string) { $string = mb_convert_encoding($string , "UTF-8" , "ISO-8859-1"); // i didn't test it , use it at your own risk and i'd rather stick with the first solution $result = false; $f = @fopen($file, 'ab+'); if ($f) { if ($this-&gt;_options['file_locking']) @flock($f, LOCK_EX); fseek($f, 0); ftruncate($f, 0); $tmp = @fwrite($f, $string); if (!($tmp === FALSE)) { $result = true; } @fclose($f); } @chmod($file, $this-&gt;_options['cache_file_umask']); return $result; } </code></pre> <p>i didn't test manually but it should work as expected </p> <p>Glad it helped ! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload