UTF-8: print from a file of codes
From JmPm
(Difference between revisions)
(New page: binmode(STDOUT, ":utf8"); # to silence: "Wide character in print " $in = <DATA>; $chr1=chr(hex ($in)); $string = "Hello $chr1 !\n"; print $string; __DATA__ 263a This program brings...) |
|||
Line 9: | Line 9: | ||
This program brings hexadecimal data from a file and prints it as a utf8 character (if it is one). | This program brings hexadecimal data from a file and prints it as a utf8 character (if it is one). | ||
The main problem here was to change a string such as '236a' which perl cannot know is a number, into a number,because of the lack of types in perl. | The main problem here was to change a string such as '236a' which perl cannot know is a number, into a number,because of the lack of types in perl. | ||
+ | |||
+ | [[Category:Sample code]] |
Current revision as of 14:32, 19 November 2008
binmode(STDOUT, ":utf8"); # to silence: "Wide character in print " $in = <DATA>; $chr1=chr(hex ($in)); $string = "Hello $chr1 !\n"; print $string; __DATA__ 263a
This program brings hexadecimal data from a file and prints it as a utf8 character (if it is one). The main problem here was to change a string such as '236a' which perl cannot know is a number, into a number,because of the lack of types in perl.