Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: german Alphabet

by ikegami (Patriarch)
on Dec 04, 2018 at 06:30 UTC ( [id://1226700]=note: print w/replies, xml ) Need Help??


in reply to german Alphabet

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1226700]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-25 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found