----- Original Message ----- 
From: "Glenn Linderman" <[EMAIL PROTECTED]>
To: "Win32 perl" <[EMAIL PROTECTED]>
Sent: Tuesday, April 10, 2007 5:41 PM
Subject: cmd /u


> So I'm looking at writing a program in Unicode, although tuits have been
> lacking, I spend a little time on it every year!
>
> Last year, folks helped me figure out that I can accept and display
> Unicode in RichEdit controls, by bypassing Win32::GUI's normal Text
> functions.
>
> This year, I've just learned about the /u switch for cmd. However, while
> that puts the command window into a mode where it appears to manipulate
> Unicode characters just fine, I haven't yet figured out the right
> incantation to convince perl to use Unicode on the console...
>
> d:\MY\PERL\src>cmd /u
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> d:\MY\PERL\src>perl
> use utf8;
> binmode(STDOUT, ":encoding(UTF-32LE)");
> print "ţ";
> ^Z
> t
> d:\MY\PERL\src>
>
> Is there an appropriate incantation? Or if not, is there any plans for 
> one?
>

I can only ever get make progress with sort of stuff using Text::Iconv ... 
but then I'm a drunken, idiotic, anachronistic reprobate who can't make 
sense of unicode. (At least, I'm three of those things ... you choose :-)

Here's my solution.

I have a file called src.txt that contains "État" (minus the quotes).

I then run this script:

------------------------
use warnings;
use strict;
use Text::Iconv;

my $tocode = "cp850";
my $fromcode = "cp1252";
my $file = 'src.txt';

open (RD, '<', $file) or die "Can't open $file: $!";
my $word = <RD>;
chomp($word);

print $word, "\n\n";

my $converter = Text::Iconv->new($fromcode, $tocode);
my $converted = $converter->convert($word);
print $converted, "\n";
-----------------------------

It outputs the following:

-----------------------------
╔tat

État
-----------------------------

I don't know if that helps ... I hope it does .... and I hope that my mail 
program faithfully reproduces what I've cop'n'pasted.

Cheers,
Rob 

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to