Re: Create an EUC-JP encoded file just for download, not to be kept on server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 09 August 2006 11:20, Dave M G wrote:
> PHP List,
>
> In the last stage of my current script, I need to take a bunch of data
> from the database and put it into a text file for the user to save to
> their computer and import into an application.
>
> The file being created is just a list of Japanese words and definitions
> delineated by tabs.
>
> The file format should be a text file. Actually, it could also be CSV
> file, since it's tab delineated data.
>
> The application being imported to only accepts EUC-JP encoding for text
> files that include Japanese text, so my data, which is stored in the
> database as UTF-8, will need to be converted to EUC-JP at some point
> along the way to being written to the file.
>
> This file need not ever be stored on the server. In fact, I'd rather it
> not so as to avoid any headaches with permissions settings (which always
> give me a headache, but that's a rant for another day).
>
> So, I'm looking on php.net for functions that would be able to create a
> file out of some data and pass it along to the user.
>
> But it seems that the assumption of all the file functions (that I've
> found) such as fwrite(), fopen(), file(), readfile(), and others are all
> about taking an existing file and working with it. And more importantly,
> all of them seem to assume that the place where the file would be stored
> is on the servers system, and not immediately passed on to the user.
>
> I have a suspicion that this is one of those situations where the
> starting point is assumed to be so simple that no one goes out of their
> way to document or explain it.
>
> I'm too lost to know where to begin.
>
> How do I create a file that the user saves, and is not stored on the
> server?
>
> --
> Dave M G

For re-encoding to EUC-JP, I would check out the multibyte functions... 
specifically mb_convert_encoding:

http://us2.php.net/manual/en/function.mb-convert-encoding.php

HTH
-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux