On Wed, Nov 14, 2012 at 4:02 AM, Victor Bombi <son...@telefonica.net> wrote: > Hello, > >> wxLua does not change the locale, but wxWidgets might to make the UI >> numeric display appropriate for users. > > That`s true: > with print(os.locale()) before and after the require"wx" I get > > C > Spanish_Spain.1252 > >> What OS are you on? If you're in Linux you can apply the patch below >> and recompile the wxLua module lib. Please let me know if it works for >> you and I will apply it to svn. > > My OS is windows. Perhaps the solution would be just calling os.locale("C") > after require"wx"?
I'm fairly new to this stuff, but curious... It looks like you can change it temporarily for a given prompt. http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fae19495_.htm Open a new command (DOS) prompt: # This is what I use normally c:\>chcp Active code page: 437 # Change it to this c:\>chcp 1252 Active code page: 1252 # Run lua and see what happens. C:\>lua.exe Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio > print(1.234, string.format("%f", 2.345), os.setlocale()) 1.234 2.345000 C > require("wx") > print(1.234, string.format("%f", 2.345), os.setlocale()) 1.234 2.345000 C > print(os.setlocale("", "all")) English_United States.1252 > print(1.234, string.format("%f", 2.345), os.setlocale()) 1.234 2.345000 English_United States.1252 On a whim, I tried this... > print(os.setlocale("Spanish_Spain.1252", "all")) Spanish_Spain.1252 > print(1.234, string.format("%f", 2.345), os.setlocale()) 1,234 2,345000 Spanish_Spain.1252 > wx.wxMessageBox(string.format("%f", 1.234), string.format("%f", 2.345), > wx.wxOK) Displays a message box using 1,234 and 2,345... Can you try the above commands and let me know what they print for you? ========================= The code I posted is to ensure that the Lua parser uses the C locale (1.0 not 1,0), but using require("wx") means that Lua has already parsed the Lua code so that doesn't matter. I imagine the right thing to do would be to save the locale before initializing wxWidgets in wx.dll then if changed set to back to what it was. I don't know if this is a suitable solution though. If the locale was forced to 'C' or back to what it was then Lua might work "normally", but the GUI would look wrong for some people. I would imagine that wxWidgets changes it to make the GUI right and that's probably the right thing to do. Hopefully you can force it back by calling Lua's os.setlocale("C", "all") and if it works I'll put it in the FAQ. Regards, John ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users