Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » localized formating of double on linux
localized formating of double on linux [message #19657] |
Tue, 30 December 2008 11:33  |
lokki
Messages: 20 Registered: November 2005
|
Promising Member |
|
|
Hello,
I'm porting application developed in UPP on Windows to Linux (using Gentoo 2008.1).
When formating double values (displayed in GridCtrl, in EditDouble), strage output appears. Following converter worked on windows but gives strange results on linux
class ConvertMoney : public ConvertDouble
{
public: ConvertMoney() : ConvertDouble() {Pattern("%2!nl");}
};
e.g. whe we have in database value 1.234, on windows is displayed string "1,23", on linux "1,00". It always changes last two charactes with zeros. Experimenting with converter's pattern gives no acceptable results.
My linux locale is:
LANG=sk_SK.utf8
LC_CTYPE=sk_SK.utf8
LC_NUMERIC="sk_SK.utf8"
LC_TIME="sk_SK.utf8"
LC_COLLATE=C
LC_MONETARY="sk_SK.utf8"
LC_MESSAGES="sk_SK.utf8"
LC_PAPER="sk_SK.utf8"
LC_NAME="sk_SK.utf8"
LC_ADDRESS="sk_SK.utf8"
LC_TELEPHONE="sk_SK.utf8"
LC_MEASUREMENT="sk_SK.utf8"
LC_IDENTIFICATION="sk_SK.utf8"
LC_ALL=
At the begining of code, the laguage is set:
int language = LNGC_('S','K','S','K', CHARSET_UTF8);
SetLanguage(language);
Database is Postgresql 8.3,
Thanks in advance for any clue.
|
|
|
|
|
|
|
Re: localized formating of double on linux [message #19669 is a reply to message #19668] |
Sat, 03 January 2009 15:09   |
lokki
Messages: 20 Registered: November 2005
|
Promising Member |
|
|
Hello,
I don't know when the GUI is initialised exactly. I set language and locale in first lines of GUI_APP_MAIN. The code looks like this...
GUI_APP_MAIN
{
int language = LNGC_('S','K','S','K', CHARSET_UTF8);
SetLanguage(language);
setlocale(LC_ALL,"C");
....
edit: So it is executed before the main window is instantiated and run.
[Updated on: Sat, 03 January 2009 15:12] Report message to a moderator
|
|
|
|
|
|
|
Re: localized formating of double on linux [message #27352 is a reply to message #19913] |
Tue, 13 July 2010 22:18  |
zsolt
Messages: 702 Registered: December 2005 Location: Budapest, Hungary
|
Contributor |
|
|
Put an extra line into /etc/locale.alias:
and run the command
from console.
I think it would be better to fix this in UPP code and trying locale with ".UTF-8" suffix when "sk_SK" type locale didn't succeed.
|
|
|
Goto Forum:
Current Time: Fri Apr 25 19:00:37 CEST 2025
Total time taken to generate the page: 0.01096 seconds
|