gtk-rs / gtk

DEPRECATED, use https://github.com/gtk-rs/gtk3-rs repository instead!

Home Page:https://gtk-rs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible bug with simultaneous work "gtk-rs" and "xlsxwriter-rs" crates

dgr113 opened this issue · comments

If I run a function that writes in Excel BEFORE running the GTK GUI the numeric data is written correctly.
But if I start writing AFTER GUI... then f64 numbers are written as integers =(

My GIT example

EDIT:
"LC_ALL=C" compilation env set helped me.
This was suggested to me by "gtk-rs" maintainers. Thanks to them =)

I assume it's enough to run gtk::init() and all the other pieces are not required?

This is definitely not a bug in the bindings, but still quite curious :) I would guess this happens because GTK is initializing things for i18n and xlswriter-rs (libxlswriter probably) somehow gets influenced by that. Maybe because in your locale numbers are written 1,2 or 1.2 and that mixes up things.

You could also try running with LC_ALL=C to see if that makes a difference.

I have allocated excel export app into a separate process and this situation has not happened again.
Although of course this is not a very convenient way...

Welcome to the C world, where non-related codes might collide because of dark magic.

I like your GTK project and sometimes I have to use export to Excel... it's sad that they can't be together yet =(

Did you try with LC_ALL=C? In any case, it would be useful to report this to the libxlswriter project as that's most likely where the underlying bug is.

I'll do it today=) Thnx for your feedback!

@dgr113 If it doesn't need to be in the same process, you can just spawn another one which will run the excel export (like you did).

I'll do it today=) Thnx for your feedback!

Thanks! Let me know what you find out and please also put the link to the libxlswriter issue here

LC_ALL=C

Hmm... it works!
This may need to be included into package docs ? What do you think ?

This only means that libxlswriter is broken and outputs data depending on the locale instead of what is expected for XLS. Standard issue with C libraries that assume the string formatting functions in C are locale-independent.

Please report this to libxlswriter and link to it here.