Re: Bug in MagickAnnoteImage() if locale is set to de_DE.UTF-8

Marvin Gülker <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
Hi,

apologies for the late reply. I forgot about the topic...

On Sun, May 28, 2017 at 06:00:44PM -0500, Bob Friesenhahn wrote:
> There is a known problem in that parsing floating point numbers (e.g.
> numbers like "200.0") may fail if the locale uses different delimiter for
> the decimal point (e.g. "200,0").  The reason for this is that all text
> formats which include floating point numbers use traditional C/POSIX locale.
> Changing the numeric locale to something else causes the operating system's
> floating point parsing and generation to operate incorrectly.

I see this, but I did not input my numbers as text at all. They're
floating-point literals directly in the C source code (just see the
example I submitted) so unless GraphicsMagick is converting them to a
string by itself, this should have no effect.

> Try adding
>
>   (void) setlocale(LC_NUMERIC,"C");
>
> after any preceding locale requests.

I can confirm this works. If I change LC_NUMERIC as advised by you, the
problem does not occur. This however looks to me more like a workaround
than like a solution. If this is the only possible way to avoid the
problem, I think GraphicsMagick should do that call on itself before it
does a text conversion, and afterwards reset it to what it was
before. Ideally however it would not depend on the locale at all.

Greetings
Marvin

-- 
Blog: https://www.guelkerdev.de
PGP/GPG ID: F1D8799FBCC8BC4F

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.