Windows and xslt dll

Miika Turkia miika.turkia at gmail.com
Wed Mar 6 07:28:34 PST 2013


On Wed, Mar 6, 2013 at 3:44 PM, Miika Turkia <miika.turkia at gmail.com> wrote:
> On Wed, Mar 6, 2013 at 3:43 PM, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
>> On 6 March 2013 15:05, Robert C. Helling <helling at lmu.de> wrote:
>>> On Wed, 6 Mar 2013, Rainer Mohr wrote:
>>>
>>> Hi,
>>>
>>>
>>>> So it would be best to not rely on the float values that the dll returns
>>>> and instead parse the float from the XML yourself...
>>>
>>>
>>> I don't know anything about Windows but I would assume that there is a
>>> corresponding function that parses strings into floats using the current
>>> locale (and one might think about using this in other places as well as
>>> mentioned yesterday but this of course opens a whole new can of worms as
>>> then the xml might become locale dependent etc).
>>>
>>
>> it could be that XSLT uses strtod() internally, which is locale bound
>> and not much can be done (unless we modify XSLT).
>>
>> glib has a g_ascii_strtod():
>> https://developer.gnome.org/glib/2.28/glib-String-Utility-Functions.html#g-ascii-strtod
>>
>> but since the cylinder volume is stored in milliliters, it would be
>> probably better to parse using:
>>
>> sscanf(buf, "%d.%d", &integral, &fraction)
>> cyl.size.mliter = (integral * 1000) +  fraction.
>
> This should do to magic. Please test.

It actually seems that it is enough to do the number formatting only
for the final result. So this is reasonably easy to add to all
required places. However, the locale trick Linus suggested would be a
lot easier to implement and it would fix this issue for all XSLT
parsing (if it works as expected on all environments).

miika


More information about the subsurface mailing list