Bug#582421: [Patch] Floating point is broken if :lang is called in gvim

Bram Moolenaar Bram at Moolenaar.net
Thu May 20 20:12:50 UTC 2010


James -

> If the locale is changed in gvim via ":lang" to a locale which uses
> comma for the decimal separator, then floating point numbers are no
> longer usable.  This only happens with the ":lang $locale" variant,
> since that sets $LANG before calling gtk_set_locale().
> 
>   env LANG=C gvim
>   :lang es_ES.UTF-8
>   :lang messages C  " so errors are in English
>   :echo ceil(1.2)
>   E806: using Float as a String
>   E116: Invalid arguments for function ceil(1.2)
>   E15: Invalid expression: ceil(1.2)
>   :echo str2float('1.2')
>   1,0
>   :echo str2float('1,2')
>   1,2
> 
> Attached patch fixes the issue by ensuring $LC_NUMERIC is set to C if
> the LC_ALL version of :lang is called.

Thanks.  In other places we do this:

    setlocale(LC_NUMERIC, "C");

Thus I think we should do the same in this place.

- Bram

-- 
hundred-and-one symptoms of being an internet addict:
85. Choice between paying Compuserve bill and paying for kids education
    is a no brainer -- although a bit painful for your kids.

 /// Bram Moolenaar -- Bram at Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///





More information about the pkg-vim-maintainers mailing list