uva has asked for the wisdom of the Perl Monks concerning the following question:
the out put is :: Unknown encoding '' it means cp936 is not present ,but ,if i used in the other program decoding with cp936 is working fine why this is happening ? can you explain that one. the program where i used cp936 is given belowuse Encode qw(encode); use Win32::Codepage; my $w32encoding = Win32::Codepage::get_encoding(); # e.g. "cp936" my $encoding = $w32encoding ? Encode::resolve_alias($w32encoding) +: ''; print $encoding ? encode($string, $encoding) : $string;
use Encode; use Win32::Codepage; use strict; use diagnostics; my $encoding= Win32::Codepage::get_encoding(); my $str8=decode($encoding,"中国的网页 +;");#$encoding has the value cp936; open OUT,">:utf8","D:\\output1.doc" or print "could not open"; print "\nIs ".encode("$encoding",$str8)." utf8 format : ",utf8::is +_utf8($str8),"\n\n"; print OUT $str8."\n"; close OUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: help needed in encoding
by borisz (Canon) on Mar 17, 2006 at 10:21 UTC | |
|
Re: help needed in encoding
by GrandFather (Saint) on Mar 17, 2006 at 10:36 UTC | |
by uva (Sexton) on Mar 17, 2006 at 12:29 UTC | |
|
Re: help needed in encoding
by borisz (Canon) on Mar 17, 2006 at 10:02 UTC |