in reply to Printing a UTF8 code

Actually, the following is correct:
open FO, ">test.txt"; binmode FO, ":utf8"; print FO "\x{00b9}";

If you see a strange character, then probably the program you're using to display your test file doesn't handle UTF-8 correctly, or must be told to do so.

I use to forget the correct syntax because I need them almost never. But a google search for "Perl unicode literals" reveals the nice article Perl Unicode Cookbook: Unicode Literals by Number by Tom Christiansen. That's how I did it right now.

Replies are listed 'Best First'.
Re^2: Printing a UTF8 code
by bobt_1234 (Initiate) on Nov 08, 2019 at 20:43 UTC
    Actually, that worked!
    Thanks!
    My mistake was using the wrong case. binmode FO, ":UTF8" # Does not work! binmode FO, ":utf8" # This works!