develooper Front page | perl.perl5.porters | Postings from March 2000

How long is a smiley?

Thread Next
Johan Vromans
March 17, 2000 12:58
How long is a smiley?
Message ID:
I'm not going to say that I understand Unicode completely, but this
puzzles me:

#!/usr/bin/perl -wl
use strict;
use charnames qw(:full);
print "Yes" if "\x{263a}" eq "\N{WHITE SMILING FACE}";	# prints Yes
print length("\x{263a}");				# 1
print length("\N{WHITE SMILING FACE}");			# 3
printf "%vx\n", "\x{263a}";				# 263a
printf "%vx\n", "\N{WHITE SMILING FACE}";		#

Actually, I'd expect Unicode characters to have length 1.

-- Johan

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About