Hi,

I'm having a problem with to_char() inserting unexpected characters as group 
separator.

For the record below, I wish to display 'credit' properly formated in an html 
form, using to_char(credit, 'FM999G990D00') 

SELECT *, to_char(credit, 'FM999G990D00') as yo from tblprospect_balance where 
id_item = 33;

 id_prospect | id_item | date_item  | libelle | debit | credit  | lettrage | 
id_facture |    yo    
-------------+---------+------------+---------+-------+---------+----------+------------+----------
         385 |      33 | 2021-03-09 | yo man  |  0.00 | 2345.10 |          |    
      8 | 2 345,10

The numbers are properly displayed in the html form. However, updating the 
record requires the user to manually delete the space in '2 345,10', otherwise 
the last digit is lost. Typing numbers including a group separator using the 
space bar works fine.

I exported the record to a text file and inspected it with emacs in hexadecimal 
mode :

3338 3509 3333 0932 3032 312d 3033 2d30  385.33.2021-03-0
00000010: 3909 796f 206d 616e 0930 2e30 3009 3233  9.yo man.0.00.23
00000020: 3435 2e31 3009 0938 0932 e280 af33 3435  45.10..8.2...345
00000030: 2c31 300a                                ,10.

As you can see, the space in field 'libelle' (yo man) is different from the one 
in field 'yo' (2...345,10)

The difference is also apparent in a link built using the record's fields as 
parameters : 

/base/prospect?id_prospect=385&balance=0&update_item=0&id_item=33&id_facture=8&date_item=2021-03-09&libelle=yo%20man&debit=0,00&credit=2%E2%80%AF345%2C10&lettrage=
                                                                                
        ^^^^^^^^^^^^^                   ^^^^^^^^^^^^
What can I do to get a standard space as group separator for my numbers?

#### system information ########
I use postgresql 11.9 on Debian buster

My settings are : 

show lc_numeric;
 lc_numeric  
-------------
 fr_FR.UTF-8

locale
LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=

\d tblprospect_balance
                                    Table "public.tblprospect_balance"
   Column    |     Type      | Collation | Nullable |                       
Default                        
-------------+---------------+-----------+----------+------------------------------------------------------
 id_prospect | integer       |           | not null | 
 id_item     | integer       |           | not null | 
nextval('tblprospect_balance_id_item_seq'::regclass)
 date_item   | date          |           | not null | CURRENT_DATE
 libelle     | text          |           |          | 
 debit       | numeric(10,2) |           | not null | 0
 credit      | numeric(10,2) |           | not null | 0
 lettrage    | text          |           |          | 
 id_facture  | integer       |           | not null | 0

-- 
                Bien à vous, Vincent Veyron

https://marica.fr/
Logiciel de gestion des sinistres assurances, des dossiers contentieux et des 
contrats pour le service juridique


Reply via email to