Skip to content

Commit 77f9bad

Browse files
committed
Fix UNICHARSET::save_to_string for locale de_DE.UTF-8
That function writes float values which must always use '.' as the decimal separator, no matter what the current locale setting is. Signed-off-by: Stefan Weil <[email protected]>
1 parent 36ed6da commit 77f9bad

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/ccutil/unicharset.cpp

+17-12
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <cstring>
2525
#include <iomanip> // for std::setw
2626
#include <locale> // for std::locale::classic
27-
#include <sstream> // for std::istringstream
27+
#include <sstream> // for std::istringstream, std::ostringstream
2828

2929
#include "params.h"
3030
#include "serialis.h"
@@ -708,19 +708,24 @@ bool UNICHARSET::save_to_string(STRING *str) const {
708708
snprintf(buffer, kFileBufSize, "%s %x %s %d\n", "NULL", properties,
709709
this->get_script_from_script_id(this->get_script(id)),
710710
this->get_other_case(id));
711+
*str += buffer;
711712
} else {
712-
// FIXME
713-
snprintf(buffer, kFileBufSize,
714-
"%s %x %d,%d,%d,%d,%g,%g,%g,%g,%g,%g %s %d %d %d %s\t# %s\n",
715-
this->id_to_unichar(id), properties,
716-
min_bottom, max_bottom, min_top, max_top, width, width_sd,
717-
bearing, bearing_sd, advance, advance_sd,
718-
this->get_script_from_script_id(this->get_script(id)),
719-
this->get_other_case(id), this->get_direction(id),
720-
this->get_mirror(id), this->get_normed_unichar(id),
721-
this->debug_str(id).string());
713+
std::ostringstream stream;
714+
stream.imbue(std::locale::classic());
715+
stream << this->id_to_unichar(id) << ' ' << properties << ' ' <<
716+
min_bottom << ',' << max_bottom << ',' <<
717+
min_top << ',' << max_top << ',' <<
718+
width << ',' << width_sd << ',' <<
719+
bearing << ',' << bearing_sd << ',' <<
720+
advance << ',' << advance_sd << ' ' <<
721+
this->get_script_from_script_id(this->get_script(id)) << ' ' <<
722+
this->get_other_case(id) << ' ' <<
723+
this->get_direction(id) << ' ' <<
724+
this->get_mirror(id) << ' ' <<
725+
this->get_normed_unichar(id) << "\t# " <<
726+
this->debug_str(id).string() << '\n';
727+
*str += stream.str().c_str();
722728
}
723-
*str += buffer;
724729
}
725730
return true;
726731
}

0 commit comments

Comments
 (0)