Thanks so much for all the great explanations! That really cleared things up. I also wrote a hack to solve the problem I alluded to at the end of my first post. It is extremely inefficient, but seems to properly carry out all of the conversions I'm interested in. Please rip it to shreds for me:
#!/usr/bin/perl -w use strict; use warnings; #Convert annoying, worthless 'fullwidth' Latin-1 characters #to their semi-sane normal ASCII counterparts my(%codes,$wide,$ascii,$x); #this is the land where the fullwidth latin-1 characters reside for($x=65281;$x<65374;$x++){ ($wide,$ascii) = make_codes($x); $codes{$wide} = $ascii; } while(<>){ chomp; foreach my $utf(keys %codes){ s/$utf/$codes{$utf}/g; } print $_."\n"; } sub make_codes{ my $ud = $_[0]; my $from = ud_to_utf8hex($ud); #subtract 65248 to get the ASCII value my $to = ud_to_utf8hex($ud-65248); return($from, $to); } sub ud_to_utf8hex{ my $ud = $_[0]; my ($b1,$b2,$b3); if($ud >= 0 && $ud <= 127){ #basic ASCII values don't need to be a +ltered return(sprintf("%c",$ud)); }elsif($ud >= 2048 && $ud <= 65535){ #valid for 2048 <= $ud <= 655 +35 $b1 = 224 + sprintf("%d", ($ud/4096)); $b2 = 128 + (($ud/64) % 64); $b3 = 128 + ($ud % 64); } return(sprintf("\\x\{%X\}\\x\{%X\}\\x\{%X\}",$b1,$b2,$b3)); }
I chose to use the decimal numbers for some practice with the unicode standard, and because they are easier on my brain than the hex codes.

In reply to Re: Intra-Unicode Conversions by kettle
in thread Intra-Unicode Conversions by kettle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.