Skip to content

Instantly share code, notes, and snippets.

@dland
Created November 27, 2013 15:49
Show Gist options
  • Save dland/7677920 to your computer and use it in GitHub Desktop.
Save dland/7677920 to your computer and use it in GitHub Desktop.
Fun with Unicode
#! /usr/bin/perl -l
use strict;
use utf8;
use open qw( :encoding(UTF-8) :std );
use charnames qw( :full :short );
my $word = "no\N{LATIN SMALL LETTER E WITH DIAERESIS}l";
my $combine = "noe\N{COMBINING DIAERESIS}l";
print uc $word;
print uc $combine;
print $word eq $combine ? 'same' : 'different';
use Unicode::Normalize;
print NFD($word) eq NFD($combine) ? 'same' : 'different';
@dland
Copy link
Author

dland commented Nov 27, 2013

Produces

NOËL
NOËL
different
same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment