dear monks,
use 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;
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 below
use Encode; use Win32::Codepage; use strict; use diagnostics; my $encoding= Win32::Codepage::get_encoding(); my $str8=decode($encoding,"中国的网&#39029 +;");#$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;

In reply to help needed in encoding by uva

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.