Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: frac12 to decimal

by CColin (Scribe)
on Feb 09, 2009 at 18:19 UTC ( #742513=note: print w/replies, xml ) Need Help??

in reply to Re: frac12 to decimal
in thread frac12 to decimal

Hi Thanks - I guess that answers the question on changing the behaviour of the module without changing the module, but having said that this particular code did not bring about the desired behaviour. That's still the piece I can't figure out what's happening? The hash in the module:
Contains the following key value pairs that seem to govern this behaviour.
frac14 => chr(188), frac12 => chr(189), frac34 => chr(190),
Presumably chr(188) and its brethren are taken straight from the HTML, then fracNN to which it is mapped is somehow translated to display as the tiny one character wide fraction symbol. But stating:
# switch package package HTML::Entities; $entity2char{frac14} = '.25'; $entity2char{frac12} = '.5'; $entity2char{frac34} = '.75'; # switch back to your package package main; # go on with your code
Does not seem to change that behaviour?

Replies are listed 'Best First'.
Re^3: frac12 to decimal
by karoshi (Novice) on Feb 10, 2009 at 00:06 UTC

    from HTML/

    # Make the opposite mapping while (my($entity, $char) = each(%entity2char)) { $entity =~ s/;\z//; $char2entity{$char} = "&$entity;"; }

    so try: change %char2entity as well

    package HTML::Entities; $char2entity{'.25'} = '¼'; $char2entity{'.5'} = '½'; $char2entity{'.75'} = '¾'; package main; ...

    or post some code to look at.

Re^3: frac12 to decimal
by Anonymous Monk on Feb 10, 2009 at 00:45 UTC
    ½ is a HTML entity, it maps directly to chr(188)/U+00BC, which in ISO88591 is vulgar fraction one quarter , and all computer programs which know how to display ISO88591 will draw on the screen ½

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://742513]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2017-04-29 18:19 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (534 votes). Check out past polls.