Thread: [HACKERS] Unacccented Fractions

[HACKERS] Unacccented Fractions

From
"David E. Wheeler"
Date:
Hello Hackers,

I noticed that unaccent.rules has spaces in front of the unaccented representation of fraction glyphs:

¼     1/4
½     1/2
¾     3/4

Note the space after the tab. In case my client kills what I’ve pasted, those lines match

¼\t[ ]1/4
½\t[ ]1/2
¾\t[ ]3/4

This makes sense to me, as I’d like “1¼”, for example to become “1 1/4”. However, that’s not what seems to happen:

=# SELECT unaccent('1¼');unaccent
----------11/4

Should that space from the rules file be preserved, so that the text doesn’t become eleven fourths?

Thanks,

David

Re: [HACKERS] Unacccented Fractions

From
Peter Eisentraut
Date:
On 3/13/17 23:01, David E. Wheeler wrote:
> I noticed that unaccent.rules has spaces in front of the unaccented representation of fraction glyphs:

> This makes sense to me, as I’d like “1¼”, for example to become “1 1/4”. However, that’s not what seems to happen:

These leading spaces come all the way from the input files that are used
to produce the unaccent rules, where they are presumably put for exactly
the reason you point out.  However, the unaccent lexer is not prepared
for that.  It just looks for any amount of whitespace separating the two
data columns.  So that might have to be fixed.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services