use if $^O eq 'MSWin32', 'Win32::OLE'; if( $^O eq 'MSWin32' ) { Win32::OLE->Options( CP => 'CP_UTF8' ); # or maybe # Win32::OLE->Options( CP => Win32::OLE::CP_UTF8 ); }