Your code does something very silly. You confuse
encode and
decode. I myself confused them for a very long time, and learned the difference only on PerlMonks.
Let's look what you do: at first you encode the string received from terminal into utf8, and then you DECODE IT BACK! So it's again in the encoding of your terminal. So there is no wonder that you can print it back to the terminal, but the Windows Registry of course misinterpretes it.
You need
$val = <STDIN>;
from_to($val, $enc, "UTF-16");
$val = <STDIN>;
from_to($val, $enc, "UTF-16");
where $enc is the encoding of your input data, 'cp1250', i suppose.
$val = <STDIN>;
from_to($val, 'cp850', 'cp1252');
UPDATE: Added the most likely variant according to
tye's note—but it can still be wrong. You need to convert from 'dos' French codepage to 'Windows' French codepage. I inserted the values for Western European codepage.
s;;Just-me-not-h-Ni-m-P-Ni-lm-I-ar-O-Ni;;tr?IerONim-?HAcker ?d;print
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.