Merge pull request #1865 from marianosimone/fix_1430_unicode_matches

only return Unicode match result when there is a match
master
Rob Emery 2015-12-09 17:43:58 +00:00
commit 9a57cda626
2 changed files with 4 additions and 1 deletions

View File

@ -41,7 +41,8 @@ handle sub {
# Search term starts with "unicode "
if ($term =~ UNICODE_RE) {
return unicode_lookup($1);
return unless my $result = unicode_lookup($1);
return $result;
}
return codepoint_description($term);

View File

@ -30,6 +30,8 @@ ddg_goodie_test(
'unicode white smiling face' => test_zci("\x{263A} U+263A WHITE SMILING FACE, decimal: 9786, HTML: ☺, UTF-8: 0xE2 0x98 0xBA, block: Miscellaneous Symbols"),
'\x{2764}' => test_zci("\x{2764} U+2764 HEAVY BLACK HEART, decimal: 10084, HTML: ❤, UTF-8: 0xE2 0x9D 0xA4, block: Dingbats"),
'unicode unknown' => undef
);
done_testing;