running "print qq{(\x{2190})};" in a script gives the same output as above.
note: im running my scripts as "perl -CS <filename>.pl" or "perl <filename>.pl"
having hardcoded unicode characters in my script isnt really what i want to do, but i was testing those to see if it could even print the characters properly, which it cant seem to do. in my first paragraph, the script to print \x{2109} prints 2 closing parenthesis on the console. however if i redirect the output (using ">") to a file, and then i open the file with say notepad it will say it is (properly) encoded as UTF8 and the output is correct (1 open and 1 close parenthesis with an arrow in the middle). running a script with contents: print "(\x{2190})\n"; will print TWO new line characters on the console. redirecting output to a file and viewing the file displays it perfectly (with only 1 newline).
to input unicode characters at the command line you can copy and paste the character from windows' "character map". there is a registry key you need to be able to enter unicode characters (ie "alt+2190", note you actually press "+" doing this way. the registry key i dont remember right now, but it works the same copying/pasting from character map.
Anonymous Monk:
i should have shown my code, i agree, but i have it above now. the version of perl im using does support these options (and i assume it would have shown an error otherwise), perl -v gives: "This is perl, v5.10.0 built for MSWin32-x86-multi-thread".
regarding your link, my font is fine, as the characters can be displayed (ie in notepad with the font set to Lucida Console, or in cmd.exe the character can be printed, however improperly when mixed, as in with parentheses above). see here for other reference, notice U+2190 is supported in this list (http://www.fileformat.info/info/unicode/font/lucida_console/list.htm).
here is a sample script to try, i put comments in it to explain the setup.
# create a file in notepad with the single unicode character U+2190 #(left arrow) # on the 2nd line, save as "UTF8" open ( FH, "<:encoding(UTF-8)", "file.txt"); # since the BOM (byte order mark) will be read, we dont want it #printed, so skip the first line. this is why we typed the arrow on #the second line # NOT first line! <FH>; # now we are at the second line, save the arrow that should be here my $line = <FH>; # this gets rid of the wide character warning, as we know it is UTF8 utf8::encode($line); # toggle between the following two print statements to see how they # differ # note the first one should print fine, but is kind of useless because # if you print anything else, the output will be incorrect. maybe #because of mixing encodings, but it works fine redirected to a file. # the second print statement shows this #print "$line"; #print "($line)"
thanks a lot for your time guys, and i hope you know what i can do to allow unicode input from command line, with proper output.
In reply to Re^2: Unicode input in windows xp (cmd.exe)
by nadroj
in thread Unicode input in windows xp (cmd.exe)
by nadroj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |