Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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:

%entity2char
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?


Comment on Re^2: frac12 to decimal
Select or Download Code
Re^3: frac12 to decimal
by karoshi (Novice) on Feb 10, 2009 at 00:06 UTC

    from HTML/Entity.pm:

    # 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2014-09-18 01:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (103 votes), past polls