I am only concerned right now about getting a clue about how to convert things like "\x{be}" into things like 0.75.

You mean like this?


use 5.14.0;
use strict;
use warnings;
use charnames qw/:full/;
use Unicode::UCD 0.32 qw/num/;

my @cp = (
    "bogus",
    "\N{DIGIT FOUR}\N{DIGIT TWO}",
    "\N{VULGAR FRACTION THREE QUARTERS}",
    "\N{VULGAR FRACTION TWO THIRDS}",
    "\N{VULGAR FRACTION ONE SEVENTH}",
    "\N{VULGAR FRACTION SEVEN EIGHTHS}",
    "\N{SUPERSCRIPT THREE}",
    "\N{SUBSCRIPT EIGHT}",
    "\N{FULLWIDTH DIGIT TWO}\N{FULLWIDTH DIGIT FIVE}",
    "\N{ROMAN NUMERAL EIGHT}",
    "\N{ROMAN NUMERAL ONE HUNDRED THOUSAND}",
    "\N{BENGALI DIGIT FOUR}\N{BENGALI DIGIT SEVEN}\N{BENGALI DIGIT FIVE}\N{BENGALI DIGIT SIX}",
    "\N{RUMI NUMBER SEVEN HUNDRED}",
    "\N{AEGEAN NUMBER NINETY THOUSAND}",
    "\N{ORIYA FRACTION THREE SIXTEENTHS}",
    "\N{TIBETAN DIGIT HALF ZERO}",
    "\N{TIBETAN DIGIT HALF ONE}",
    "\N{TIBETAN DIGIT HALF SEVEN}",
    "\N{BENGALI CURRENCY NUMERATOR ONE LESS THAN THE DENOMINATOR}",
    "\N{GREEK ACROPHONIC ATTIC FIFTY THOUSAND STATERS}",
);

for my $cp (@cp) {
    printf "%s\t= %20s\tU+%vX\n", $cp, num($cp) // "NaN", $cp;
}
__END__
bogus   =                  NaN  U+62.6F.67.75.73
42      =                   42  U+34.32
¾       =                 0.75  U+BE
⅔       =    0.666666666666667  U+2154
⅐       =    0.142857142857143  U+2150
⅞       =                0.875  U+215E
³       =                    3  U+B3
₈       =                    8  U+2088
25    =                   25  U+FF12.FF15
Ⅷ       =                    8  U+2167
ↈ       =               100000  U+2188
৪৭৫৬    =                 4756  U+9EA.9ED.9EB.9EC
𐹸       =                  700  U+10E78
𐄳       =                90000  U+10133
୷       =               0.1875  U+B77
༳       =                 -0.5  U+F33
༪       =                  0.5  U+F2A
༰       =                  6.5  U+F30
৸       =                 0.75  U+9F8
𐅖       =                50000  U+10156

In reply to Re: Python unicodedata equivalent, or, how to convert unicode fraction to a usable fraction by tchrist
in thread Python unicodedata equivalent, or, how to convert unicode fraction to a usable fraction by parv

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.