how do i input unicode characters into a perl command-line program (using "cmd.exe") and have the character(s) printed back to the console properly?
i have tried using the perl "-C" switch to "tell" perl how to expect command line input, but it does not work. i have tried setting the "binmode", and "encode"/"decode"-ing. i input characters either by using the windows "character map" or using "alt+####" (for example alt+2190 for a left arrow). when i try to output the character it will print a "?" (question mark), which i understand the reason for this is because it does not know how to represent this character or understand it.
in cmd.exe i have used "chcp 65001" to set the encoding to UTF-8, and changed the font to "Lucida Console".
if i write a perl script to output a hardcoded unicode character (ie "\x{2190}") it does not print properly to the screen, however if i write it to a file or redirect the output to a file, it appears perfectly in the file. for example if i were to run the following: print "(\x{2190})";it would appear, in the console, as something like: ")<left arrow printed properly here>)" notice the first open parenthesis is printed as a close parenthesis. this happens if it is any character, not just parenthesis (of course). there seems to be some confusion on cmd.exe's part, as you can see the last character is printed either 2 times or overwrites the first character.
using the same perl script in linux (ie "konsole") works, and, as stated above, the script works when output is to a file. this likely means that it is a cmd.exe problem and not perl. i think a similar solution is necessary to allow unicode input in windows too.
thanks for any help
In reply to Unicode input in windows xp (cmd.exe) by nadroj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |