Roxas240 / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

Counter function latin/alpha #241

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run flying saucer on 
https://github.com/AlexanderDaniel/flying-saucer-playground/blob/master/src/main
/resources/lachdrache/latinCounterIssue.html (file is attached as well)

What is the expected output?
Y) Counter is 25 
Z) Counter is 26
AA) Counter is 27

What do you see instead?
Y) Counter is 25
A@) Counter is 26
AA) Counter is 27

What version of the product are you using? On what operating system?
Using version R8.

The issue can be fixed by replacing the function toLatin 
https://github.com/flyingsaucerproject/flyingsaucer/blob/2e4223c0a6f9571264b2205
d74013c652a161a35/flying-saucer-core/src/main/java/org/xhtmlrenderer/layout/Coun
terFunction.java#L76 with following code:

    static String toLatin(int val) {
        String result = "";
        val -= 1;
        while (val >= 0) {
            int letter = val % 26;
            val = val/26 - 1;
            result = ((char) (letter + 65)) + result;
        }
        return result;
    }

Original issue reported on code.google.com by lachdra...@gmail.com on 25 Jul 2014 at 1:41

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

I've created https://github.com/flyingsaucerproject/flyingsaucer/pull/58 which 
has been merged in the meantime.

Thanks for your fix.

Original comment by j...@k15t.com on 18 Sep 2014 at 12:36