0

I'm writing a simple c++ interface to gnuplot for a Qt application. Numeric and date-time user data is locale-aware, so it could be "1234.567", "1,234", "1.234,567" or whatever Qt supports. Gnuplot offers decimalsign option, and it also works, but I don't know a way how to convert Qt locale name to gnuplot locale name. For example, Qt locale name returns ru_RU and gnuplot show locale returns

gnuplot LC_CTYPE   Russian_Russia.1251
gnuplot encoding   cp1251
gnuplot LC_TIME    Russian_Russia.1251
gnuplot LC_NUMERIC C

There are an unaswered question about locales and (probably outdated) related question.

I'm aware of gnuplot-iostreams, but is seems to me that the library itself does not enforce any locale, so it will not work either if locales in Qt and gnuplot are mismatched.

Is there any cross-platform way (Windows, Unix, MacOS) to convert Qt locale name to gnuplot locale name? Or may be there is a better way to handle all of this?

Thank you.

Suthiro
  • 1,210
  • 1
  • 7
  • 18
  • According to the gnuplot documentation, `Russian_Russia.1251` is the Windows form, on Linux I have `en_GB.utf8`. I don't have gnuplot on Windows available, but does a Windows-gnplot accept the Linux format? => What happens if you try `set decimalsign locale "ru_RU"` on Windows? I don't know anything about MacOS. – maij Feb 25 '21 at 00:04
  • @maij Unfortunately, `set decimalsign locale "ru_RU"` outputs `Could not find requested locale` on Windows. It's the first thing I tried. – Suthiro Feb 25 '21 at 20:36

0 Answers0