[vtkusers] wx/vtk weirdness

Francois Bertel francois.bertel at kitware.com
Fri Nov 27 12:17:19 EST 2009


... starting with regression tests that do the following:

For a text reader:

1. switch to a locale known to be different than English regarding
numerical rules, like French where "," and "." have opposite meaning.
2. read the file (assuming the file to read is encoded in C|POSIX locales)

For a text writer:
1. switch to a non English locale
2. write a file
3. switch to an English locale
4. read the file


On Fri, Nov 27, 2009 at 12:07 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> Looks like we have some work to do in both itk and vtk.
>
> Bill
>
> On Fri, Nov 27, 2009 at 12:05 PM, Francois Bertel
> <francois.bertel at kitware.com> wrote:
>> note: it is necessary to duplicate the return value of setlocale() as
>> it can be a pointer to a static string.
>>
>> On Fri, Nov 27, 2009 at 12:04 PM, Francois Bertel
>> <francois.bertel at kitware.com> wrote:
>>> Something like that:
>>>
>>> // save the current locale
>>>  prev_locale = setlocale(LC_NUMERIC, NULL);
>>>  prev_locale = dupstring(setlocale(LC_NUMERIC, NULL));
>>> setlocale(LC_NUMERIC, "POSIX");
>>>
>>> <reader code here>
>>>
>>> // Restore locale
>>> setlocale(LC_NUMERIC, prev_locale);
>>> if(prev_locale)
>>> {
>>>  setlocale(LC_NUMERIC, prev_locale);
>>> }
>>>
>>> ref: http://www.zsh.org/mla/workers/2003/msg00210.html
>>>
>>> I don't think bug 5891 is relevant as it elimitates the use of
>>> interpretation of text into numerical values.
>>> Patch in bug 1431 was using the selocale() function (as above).
>>>
>>>
>>> On Fri, Nov 27, 2009 at 11:58 AM, Mathieu Malaterre
>>> <mathieu.malaterre at gmail.com> wrote:
>>>> On Fri, Nov 27, 2009 at 5:57 PM, Marcus D. Hanwell
>>>> <marcus.hanwell at kitware.com> wrote:
>>>>> The C functions as I remember set the locale globally which can also cause
>>>>> unexpected bugs if a library changes this internally.
>>>>
>>>> Ah ! That answer my question :)
>>>>
>>>> Thx
>>>> --
>>>> Mathieu
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>
>>>
>>>
>>>
>>> --
>>> François Bertel, PhD  | Kitware Inc. Suite 204
>>> 1 (518) 371 3971 x113 | 28 Corporate Drive
>>>                      | Clifton Park NY 12065, USA
>>>
>>
>>
>>
>> --
>> François Bertel, PhD  | Kitware Inc. Suite 204
>> 1 (518) 371 3971 x113 | 28 Corporate Drive
>>                      | Clifton Park NY 12065, USA
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>



-- 
François Bertel, PhD  | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
                      | Clifton Park NY 12065, USA



More information about the vtkusers mailing list