Looks like the string should be encoded as per the Active Code Page (though it could be a coincidence).

#!/usr/bin/perl use warnings; use strict; use feature qw( say ); use utf8; use Win32 qw( ); my ($active_cp, $input_cp, $output_cp); BEGIN { $active_cp = "cp" . Win32::GetACP(); $input_cp = "cp" . Win32::GetConsoleCP(); $output_cp = "cp" . Win32::GetConsoleOutputCP(); } use open ':encoding(UTF-8)'; BEGIN { binmode(STDIN, ":encoding($input_cp)"); binmode(STDOUT, ":encoding($output_cp)"); binmode(STDERR, ":encoding($output_cp)"); } use Encode qw( encode decode ); use Win32::OLE qw( in with ); use Win32::OLE::Const 'Microsoft Excel'; { # Decoded string aka string of Unicode Code Points my $german_text = 'Fräsen und ndk (Kamera - Fräsaufnahme)'; my $xl_form = "C:/tmp/german.xls"; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') or do { Win32::OLE->new('Excel.Application', 'Quit'); die("Error"); }; $Excel->{DisplayAlerts} = 1; my $Book = $Excel->Workbooks->Open($xl_form); my $Sheet = $Book->Worksheets("DRC"); $Sheet->Range("B2")->{Value} = encode($active_cp, $german_text); }

PS - Why did you comment out use strict;?!? You have a number of scoping errors it would have identified.


In reply to Re: german Alphabet by ikegami
in thread german Alphabet by shreedara75

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.