Welcome Guest, Not a member yet? Register   Sign In
Saving a utf8 character file to a zip file
#1

[eluser]Unknown[/eluser]
I would like to save a view to a file that is then put in a zip file. The view is being generated with data from a mysql DB. The DB is set to unicode. The view has the utf8 meta tag added. And Db config seems to be OK. I am also viewing this file through the web (without saving and zipping) and everything seems to be working just fine and displaying as expected. The problem seems to be when I am saving to a file then zipping.

To get this working on the web portion, I followed this page that told me to create a utf8_helper function like below which is being autoloaded ...

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Rewrite all outgoing text into UTF8 compatible streams
* Author: Matt Carter <[email protected]>
* Info: http://hash-bang.net/2009/02/utf8-with-codeigniter
*/
function ob_utf8($string) {
    return utf8_decode($string);
}
ob_start('ob_utf8');

foreach ($_POST as $key => $val) { // Re-write all incoming text into UTF8 streams
    if (is_array($val)) {
        $_POST[$key] = array_map(“utf8_encode”, $val);
    } else {
        $_POST[$key] = utf8_encode($val);
    }
}
?&gt;

Any help would be very much appreciated.
#2

[eluser]Unknown[/eluser]
Hi,
I have the same problem when trying to add file to zip archive. My files named using Japanese characters(UTF-8), when these files are zipped, file name does not display correctly (contents inside the files still display well).
Please help me.
Thanks for any helps.




Theme © iAndrew 2016 - Forum software by © MyBB