Skip to content

Commit

Permalink
Only set LC_NUMERIC instead of LC_ALL
Browse files Browse the repository at this point in the history
It's enough to set the decimal-point character to the default locale. Also reset locale after rendering. Leaving locale as C breaks PDF export in Marker:
fabiocolacio/Marker#304 (comment)
  • Loading branch information
City-busz committed Jun 5, 2021
1 parent a0e6491 commit 958d5f0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/svg.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,8 @@ title_to_svg(char* buffer,
char *
chart_to_svg(chart* chart)
{
setlocale(LC_ALL, "C");
char * current = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C");
char * buffer = malloc(1024*1024*sizeof(char));
memset(buffer, 0, 1024*1024);
svg_header(buffer, chart->width, chart->height);
Expand Down Expand Up @@ -737,6 +738,6 @@ chart_to_svg(chart* chart)
ticks_free(x_t);
ticks_free(y_t);

// setlocale(LC_ALL, "C");
setlocale(LC_NUMERIC, current);
return buffer;
}

0 comments on commit 958d5f0

Please sign in to comment.