Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Transform ASCII into UniCode

by GrandFather (Saint)
on Mar 23, 2021 at 04:05 UTC ( [id://11130177]=note: print w/replies, xml ) Need Help??


in reply to Transform ASCII into UniCode

a comment rather than an answer. Consider:

use strict; use warnings; use Encode; binmode *STDOUT, 'utf8'; # Suppress "wide character" warnings my $CharSet = 'a'; # ASCII my $BoldSet = pack('U', 119834); # Unicode bold 'a' my $Source = 'a'; my $trTarget = $Source; my $reTarget = $Source; $trTarget =~ tr/$CharSet/$BoldSet/; $reTarget =~ s/$CharSet/$BoldSet/; print "$Source\n$trTarget\n$reTarget\n"; print $BoldSet;

Prints:

a l 𝐚 𝐚

It seems tr/// isn't the right tool for the job. :-(

Update: PerlMonks is screwing up the unicode characters. They render correctly when I paste them into the edit window, but are shown as code points when I submit the edit. Bugger.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Replies are listed 'Best First'.
Re^2: Transform ASCII into UniCode
by Anonymous Monk on Mar 23, 2021 at 09:00 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11130177]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-26 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found