Skip to content

Commit

Permalink
Fix UNICHARSET::save_to_string for locale de_DE.UTF-8
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stweil committed May 16, 2019
1 parent 36ed6da commit 77f9bad
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/ccutil/unicharset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <cstring>
#include <iomanip> // for std::setw
#include <locale> // for std::locale::classic
#include <sstream> // for std::istringstream
#include <sstream> // for std::istringstream, std::ostringstream

#include "params.h"
#include "serialis.h"
Expand Down Expand Up @@ -708,19 +708,24 @@ bool UNICHARSET::save_to_string(STRING *str) const {
snprintf(buffer, kFileBufSize, "%s %x %s %d\n", "NULL", properties,
this->get_script_from_script_id(this->get_script(id)),
this->get_other_case(id));
*str += buffer;
} else {
// FIXME
snprintf(buffer, kFileBufSize,
"%s %x %d,%d,%d,%d,%g,%g,%g,%g,%g,%g %s %d %d %d %s\t# %s\n",
this->id_to_unichar(id), properties,
min_bottom, max_bottom, min_top, max_top, width, width_sd,
bearing, bearing_sd, advance, advance_sd,
this->get_script_from_script_id(this->get_script(id)),
this->get_other_case(id), this->get_direction(id),
this->get_mirror(id), this->get_normed_unichar(id),
this->debug_str(id).string());
std::ostringstream stream;
stream.imbue(std::locale::classic());
stream << this->id_to_unichar(id) << ' ' << properties << ' ' <<
min_bottom << ',' << max_bottom << ',' <<
min_top << ',' << max_top << ',' <<
width << ',' << width_sd << ',' <<
bearing << ',' << bearing_sd << ',' <<
advance << ',' << advance_sd << ' ' <<
this->get_script_from_script_id(this->get_script(id)) << ' ' <<
this->get_other_case(id) << ' ' <<
this->get_direction(id) << ' ' <<
this->get_mirror(id) << ' ' <<
this->get_normed_unichar(id) << "\t# " <<
this->debug_str(id).string() << '\n';
*str += stream.str().c_str();
}
*str += buffer;
}
return true;
}
Expand Down

0 comments on commit 77f9bad

Please sign in to comment.