in reply to HTML::Entities and Unicode quotes

encode_entities expects a string of text for argument. As far as it's concerned, you passed the following 12 characters:

U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX U+0080 An unnamed control character U+009C STRING TERMINATOR, a control character q u o t e s U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX U+0080 An unnamed control character U+009D OPERATING SYSTEM COMMAND, a control character

You want to pass

U+201C LEFT DOUBLE QUOTATION MARK q u o t e s U+201D RIGHT DOUBLE QUOTATION MARK

So instead of

encode_entities("\xe2\x80\x9cquotes\xe2\x80\x9d")

you should have used

encode_entities("\x{201C}quotes\x{201D}")

What you passed is the bytes resulting from encoding "\x{201C}quotes\x{201D}" using UTF-8, so you could also use

encode_entities(decode("UTF-8", "\xe2\x80\x9cquotes\xe2\x80\x9d"))

decode comes from Encode.