Re: incantation for uploading shift-jis files

2005-12-26 Thread John Delacour
At 9:10 am +0900 26/12/05, Joel Rees wrote: I note your are running both the script and the HTML in Unicode UTF-8. There is wisdom in that, of course, and I may rethink my choice of running these scripts in shift-JIS. (I like to avoid conversions that require tables and context decisions as

Re: incantation for uploading shift-jis files

2005-12-26 Thread Joel Rees
Do you know of a way to tell perl, or, rather, the CGI module to open the file handle as shift-JIS? open F, :encoding(shift_jis), $f Okay, okay, I see I have shown my laziness. However, I have just dug into chapter 8 of the Cookbook (Second edition) and found a couple of relevant bits,

Re: incantation for uploading shift-jis files

2005-12-26 Thread John Delacour
At 12:00 am +0900 27/12/05, Joel Rees wrote: I'll have to tell you a war story or two, sometime. Unicode is a kludge. It's one of the better kludges, and evidence that kludges make the world go round... Just as well it doesn't rely on iso-2022-jp or us-ascii. It's not Unicode that is the

Re: incantation for uploading shift-jis files

2005-12-26 Thread Joel Rees
The script below reduces the problem to its simplest. Notice the deadly caveats. In my experience (and I have war stories too) the harder one tries with Perl/Unicode the worse the mess you get into. You can probably forget about locale -- try “use encoding (:locale)” in the script below and

Re: incantation for uploading shift-jis files

2005-12-26 Thread Joel Rees
erm I think I forgot to point out what I changed -- Now, as far as my little problem goes, I was able to get some success with the following: -snippet-- use encoding( 'Shift_JIS' ); ... my $query = new CGI; ... my $fileToSend = $query-param( 'file-to-send' );

Re: incantation for uploading shift-jis files

2005-12-25 Thread Joel Rees
On 2005.12.25, at 10:58 AM, John Delacour wrote: At 1:45 am + 25/12/05, John Delacour wrote: The script is here, warts and all: http://bd8.com/temp/upload.pl.txt I note your are running both the script and the HTML in Unicode UTF-8. There is wisdom in that, of course, and I may

Re: incantation for uploading shift-jis files

2005-12-25 Thread Joel Rees
I think that the problem is that I have set the encoding (multi-part) for the post, but not for the file part, and I can't figure out how to set the encoding for the file part. I'm worried that I'm going to have to force a re-conversion within perl from some sort of automatic conversion done

Re: incantation for uploading shift-jis files

2005-12-25 Thread John Delacour
At 9:22 am +0900 26/12/05, Joel Rees wrote: Do you know of a way to tell perl, or, rather, the CGI module to open the file handle as shift-JIS? open F, :encoding(shift_jis), $f JD

incantation for uploading shift-jis files

2005-12-24 Thread Joel Rees
Anyone know? I've looked around on the web, and it looks like I'm playing with edge-of-the-world stuff and rather OS and browser dependent. The source I'm working with: http://reiisi.homedns.org/~joel/cs/ranbunhyou/withfile2.text

Re: incantation for uploading shift-jis files

2005-12-24 Thread John Delacour
At 7:10 pm +0900 24/12/05, Joel Rees wrote: I've looked around on the web, and it looks like I'm playing with edge-of-the-world stuff and rather OS and browser dependent. The source I'm working with: http://reiisi.homedns.org/~joel/cs/ranbunhyou/withfile2.text

Re: incantation for uploading shift-jis files

2005-12-24 Thread Joel Rees
On 2005.12.24, at 09:24 PM, John Delacour wrote: At 7:10 pm +0900 24/12/05, Joel Rees wrote: I've looked around on the web, and it looks like I'm playing with edge-of-the-world stuff and rather OS and browser dependent. The source I'm working with:

Re: incantation for uploading shift-jis files

2005-12-24 Thread Jeff Lowrey
At 04:17 PM 12/24/2005, Joel Rees wrote: I think that the problem is that I have set the encoding (multi-part) for the post, but not for the file part, and I can't figure out how to set the encoding for the file part. Encoding is set as a MIME header on each MIME part - or can be. -jeff

Re: incantation for uploading shift-jis files

2005-12-24 Thread Thilo Planz
I think that the problem is that I have set the encoding (multi-part) for the post, but not for the file part, and I can't figure out how to set the encoding for the file part. I'm worried that I'm going to have to force a re-conversion within perl from some sort of automatic conversion done

Re: incantation for uploading shift-jis files

2005-12-24 Thread John Delacour
At 10:30 am +0900 25/12/05, Thilo Planz wrote: So you will have to auto-detect the encoding on the server-side or give the user a pulldown to select the file encoding (or support only Shift-JIS, which you might get away with in your case). Here's an example that deals with sjis text files

Re: incantation for uploading shift-jis files

2005-12-24 Thread John Delacour
At 1:45 am + 25/12/05, John Delacour wrote: The script is here, warts and all: http://bd8.com/temp/upload.pl.txt NB. Safari doesn't treat it as as text file. FireFox, Opera, Omniweb display it properly as text. JD