Bug 445868 - Okular fills "number only" PDF forms fields with the wrong thousands separator.
Summary: Okular fills "number only" PDF forms fields with the wrong thousands separator.
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 21.08.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-21 16:29 UTC by tnemeth
Modified: 2021-11-29 11:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
PDF with numbers only form fields (600.16 KB, application/pdf)
2021-11-22 07:11 UTC, tnemeth
Details
entering the value (17.28 KB, image/png)
2021-11-22 10:57 UTC, tnemeth
Details
switching to the next field (17.31 KB, image/png)
2021-11-22 10:58 UTC, tnemeth
Details
closing the form fields (16.95 KB, image/png)
2021-11-22 10:59 UTC, tnemeth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tnemeth 2021-11-21 16:29:47 UTC
SUMMARY
In my locale (FR) the decimal separator is the comma and the thousands separator is either none or space. In the US, the thousands separator is the comma... When filling my tax information forms, when I want to put 1000, it displays "1,000" which really means "1" locally.


STEPS TO REPRODUCE
1. Have a PDF with numbers only form fields and a locale that doesn't have "," as thousands separator
2. Fill the form field with a big enough number
3. Close the form fields and look at the results.

OBSERVED RESULT
A field with the value "1000" inside displays "1,000".

EXPECTED RESULT
It should display "1 000".

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.23.3
KDE Frameworks Version:  5.86.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Albert Astals Cid 2021-11-21 22:23:46 UTC
Please attach such a PDF
Comment 2 tnemeth 2021-11-22 07:11:27 UTC
Created attachment 143825 [details]
PDF with numbers only form fields

Numbers only form fields are, for example, in cases B1-6 and B1-8.
Comment 3 Albert Astals Cid 2021-11-22 10:49:57 UTC
I don't see the problem

https://i.imgur.com/nm61LCW.png

Have you modified the default fr_FR.UTF-8 somehow?
Comment 4 tnemeth 2021-11-22 10:57:27 UTC
Created attachment 143830 [details]
entering the value

When the forms field are set to "editable", I enter a value in a number-only field. It's displayed correctly...
Comment 5 tnemeth 2021-11-22 10:58:27 UTC
Created attachment 143831 [details]
switching to the next field

When I switch to the next field, the comma separator appears even though I did not put it there...
Comment 6 tnemeth 2021-11-22 10:59:21 UTC
Created attachment 143832 [details]
closing the form fields

Finally when I close the form fields, the value with the wrong thousands separator appears.
Comment 7 tnemeth 2021-11-22 11:01:15 UTC
(In reply to Albert Astals Cid from comment #3)
> I don't see the problem
> https://i.imgur.com/nm61LCW.png

    Indeed...


> Have you modified the default fr_FR.UTF-8 somehow?

    Never.  I'm too old for these kind of games :)

As you can see I added screenshots of the several steps I took when entering a value...
Comment 8 Albert Astals Cid 2021-11-22 11:08:51 UTC
ah, right, it's a bunch of javascript executed on focus out.

I'll try to see if i can figure out what's going on.
Comment 9 tnemeth 2021-11-22 11:41:44 UTC
(In reply to Albert Astals Cid from comment #8)
> ah, right, it's a bunch of javascript executed on focus out.
> 
> I'll try to see if i can figure out what's going on.

Thanks :)
In the meantime I have a workaround : edit the PDF with LO Draw to remove the comma (and add my signature)...
Comment 10 Albert Astals Cid 2021-11-22 23:01:43 UTC
Git commit 4cde8b5361ffe92d9eb33d9c07e497ee144d8e4c by Albert Astals Cid.
Committed on 22/11/2021 at 22:59.
Pushed by aacid into branch 'fix_AFNumber_Format'.

Fix implementation of AFNumber_Format

We did not take sepStyle 3 into account.

Also sepStyle 1 and 0 where mixed up and it didn't work either because
replace() needs to be assigned back to the string

M  +18   -11   core/script/builtin.js

https://invent.kde.org/graphics/okular/commit/4cde8b5361ffe92d9eb33d9c07e497ee144d8e4c
Comment 11 Albert Astals Cid 2021-11-22 23:02:25 UTC
Not fixed yet, sorry, needs https://invent.kde.org/graphics/okular/-/merge_requests/507 to be merged first
Comment 12 tnemeth 2021-11-23 17:14:09 UTC
(In reply to Albert Astals Cid from comment #11)
> Not fixed yet, sorry, needs
> https://invent.kde.org/graphics/okular/-/merge_requests/507 to be merged
> first

:)

Anyway, thanks for all. I hope I'll have an updated debian package once the fix is merged ;)
Comment 13 Albert Astals Cid 2021-11-29 11:45:18 UTC
Git commit 0d4f4637292a909fca1008de49bfb77d534931d6 by Albert Astals Cid.
Committed on 29/11/2021 at 11:15.
Pushed by aacid into branch 'release/21.12'.

Fix implementation of AFNumber_Format

We did not take sepStyle 3 into account.

Also sepStyle 1 and 0 where mixed up and it didn't work either because
replace() needs to be assigned back to the string

M  +18   -11   core/script/builtin.js

https://invent.kde.org/graphics/okular/commit/0d4f4637292a909fca1008de49bfb77d534931d6