http://www.perlmonks.org?node_id=909368


in reply to Re^4: How do I convert a sequence of hexes (D0 D6) to Chinese characters (中)?
in thread How do I convert a sequence of hexes (D0 D6) to Chinese characters (中)?

My example script simply printed out UTF-8 characters on STDOUT. In my case I ran the script in GNOME terminal under Linux and the correct character was displayed. Under Linux, your $LANG environment variable would typically need to be set to a UTF-8 locale for this to work (mine is set to "en_NZ.UTF-8"). If you were trying to run the script on Windows, it is very unlikely the command window will correctly display UTF-8.

But printing to STDOUT is only one option for output. You might chose to write to a file or a database or even a network socket. If you write to a file, you should be able to open and view the file in a web browser - all web browsers understand UTF-8.

  • Comment on Re^5: How do I convert a sequence of hexes (D0 D6) to Chinese characters (中)?