Hello everyone.
I ran into difficulty. That's the problem. I need to take the content of the file, add something, something to remove and place the edited text to the clipboard. Everything works fine, but there is one little "but". But at the output I get "?"s instead of the input symbols. Here's a simplified script:
001 002 003 004 005 006 007 008 009 010 011 012 013 014 | $enc = [text.encoding]
$content = (gc $args[0]).foreach({
$in_cp = $enc::getencoding( 1251 )
$out_cp = $enc::getencoding( 65001 ) # What code page must be?
$input = $enc::convert( $in_cp, $out_cp2, $out_cp.getbytes( $_ ))
$out_cp.getstring( $input )
})
$content | clip
# file (input codepage) > script >> clipboard (input codepage) >>> file |
P.S. Set-Content and Out-File both work correctly
P.P.S. iconv does not do any help