Re: [Encode] Request for testing: piconv vs. Win32

2004-10-05 Thread Dan Kogai
On Oct 06, 2004, at 02:12, Steve Hay wrote:
I created the attached "in" file (utf-8) and ran the command-line in 
the
original bug report:

piconv -f utf-8 -t UTF-16LE in > out
This produces the attached "out" file, which looks right to me.
I also saved the "in" file to another name in UTF-16LE format using
Windows' Notepad program and the file that it output was identical to
the "out" file produced by piconv.
So that's a thumbs-up from me.  I'm running Encode 2.02 with perl 5.8.5
on Windows XP.
Thanks a meg.  I'll $Encode::VERSION++ right away.
Dan the Encode Maintainer


Re: [Encode] Request for testing: piconv vs. Win32

2004-10-05 Thread Steve Hay
Dan Kogai wrote:

>Porters,
>
>Can somebody w/ Win32 access test the patch below mentioned in RT#7831: 
>"piconv with ascii-incompatible output breaks on Win32" ?
>
>http://rt.cpan.org/NoAuth/Bug.html?id=7831
>
>I have submitted the patch but there was no response from the reporter 
>and I do not have an access to Win32 platforms right now.
>
I created the attached "in" file (utf-8) and ran the command-line in the 
original bug report:

piconv -f utf-8 -t UTF-16LE in > out

This produces the attached "out" file, which looks right to me.

I also saved the "in" file to another name in UTF-16LE format using 
Windows' Notepad program and the file that it output was identical to 
the "out" file produced by piconv.

So that's a thumbs-up from me.  I'm running Encode 2.02 with perl 5.8.5 
on Windows XP.

Cheers,
- Steve

PS. Why is my minor enhancement request 
(https://rt.cpan.org/NoAuth/Bug.html?id=6695) marked as resolved when it 
isn't?



Radan Computational Ltd.

The information contained in this message and any files transmitted with it are 
confidential and intended for the addressee(s) only.  If you have received this 
message in error or there are any problems, please notify the sender immediately.  The 
unauthorized use, disclosure, copying or alteration of this message is strictly 
forbidden.  Note that any views or opinions presented in this email are solely those 
of the author and do not necessarily represent those of Radan Computational Ltd.  The 
recipient(s) of this message should check it and any attached files for viruses: Radan 
Computational will accept no liability for any damage caused by any virus transmitted 
by this email.
Hello
world!
Isnt
this
great?


out
Description: Binary data


[Encode] Request for testing: piconv vs. Win32

2004-10-05 Thread Dan Kogai
Porters,
Can somebody w/ Win32 access test the patch below mentioned in RT#7831: 
"piconv with ascii-incompatible output breaks on Win32" ?

http://rt.cpan.org/NoAuth/Bug.html?id=7831
I have submitted the patch but there was no response from the reporter 
and I do not have an access to Win32 platforms right now.

Dan the Encode Maintainer

> perl -MEncode -e
>"local$/;$_=<>;binmode(STDOUT);Encode::from_to($_,'utf-8','UTF-
>16LE');print" in > out
This should be resolved by applying binmode to the input filehandle.  
The patch below
should fix that.  Would you try and tell me what happens?

Dan the Maintainer Thereof
--- bin/piconv  2004/05/16 20:55:16 2.0
+++ bin/piconv  2004/09/30 18:40:17
@@ -1,5 +1,5 @@
 #!./perl
-# $Id: piconv,v 2.0 2004/05/16 20:55:16 dankogai Exp dankogai $
+# $Id: piconv,v 2.0 2004/05/16 20:55:16 dankogai Exp $
 #
 use 5.8.0;
 use strict;
@@ -52,25 +52,39 @@
 EOT
 }
-# default
-if ($scheme eq 'from_to'){
-while(<>){
-   Encode::from_to($_, $from, $to, $Opt{check}); print;
-};
-# step-by-step
-}elsif ($scheme eq 'decode_encode'){
-   while(<>){
-   my $decoded = decode($from, $_, $Opt{check});
-   my $encoded = encode($to, $decoded);
-   print $encoded;
-};
-# NI-S favorite
-}elsif ($scheme eq 'perlio'){
-binmode(STDIN,  ":encoding($from)");
-binmode(STDOUT, ":encoding($to)");
-while(<>){ print; }
-} else { # won't reach
-die "$name: unknown scheme: $scheme";
+# we do not use <> (or ARGV) for the sake of binmode()
[EMAIL PROTECTED] or push @ARGV, \*STDIN;
+
+unless ($scheme eq 'perlio'){
+binmode STDOUT;
+for my $argv (@ARGV){
+   my $ifh = ref $argv ? $argv : undef;
+   $ifh or open $ifh, "<", $argv or next;
+   binmode $ifh;
+   if ($scheme eq 'from_to'){  # default
+   while(<$ifh>){
+   Encode::from_to($_, $from, $to, $Opt{check});
+   print;
+   }
+   }elsif ($scheme eq 'decode_encode'){ # step-by-step
+   while(<$ifh>){
+   my $decoded = decode($from, $_, $Opt{check});
+   my $encoded = encode($to, $decoded);
+   print $encoded;
+   }
+   } else { # won't reach
+   die "$name: unknown scheme: $scheme";
+   }
+}
+}else{
+# NI-S favorite
+binmode STDOUT => "raw:encoding($to)";
+for my $argv (@ARGV){
+   my $ifh = ref $argv ? $argv : undef;
+   $ifh or open $ifh, "<", $argv or next;
+   binmode $ifh => "raw:encoding($from)";
+   print while(<$ifh>);
+}
 }
 sub list_encodings{