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

How long is a smiley?

Thread Next
From:
Johan Vromans
Date:
March 17, 2000 12:58
Subject:
How long is a smiley?
Message ID:
14546.40014.612274.599849@phoenix.squirrel.nl
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}";		# e2.98.ba
__END__

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

-- Johan

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About