|
Lines 265-271
Link Here
|
| 265 |
return ret; |
265 |
return ret; |
| 266 |
} |
266 |
} |
| 267 |
|
267 |
|
|
|
268 |
// bnc#683881 |
| 269 |
static std::string nbsp_fixed_string (const std::string& str) |
| 270 |
{ |
| 271 |
std::string s; |
| 272 |
const char *p; |
| 273 |
unsigned char prev; |
| 268 |
|
274 |
|
|
|
275 |
p = str.c_str(); |
| 276 |
for (; *p; p++) { |
| 277 |
// fix invalid NBSP in ru or fi locales |
| 278 |
if (prev == 0xc2 && (unsigned char)*p < 0x80) |
| 279 |
s += (char)0xa0; |
| 280 |
s += *p; |
| 281 |
prev = *p; |
| 282 |
} |
| 283 |
return s; |
| 284 |
} |
| 285 |
|
| 269 |
// bnc#460094 |
286 |
// bnc#460094 |
| 270 |
static YCPValue |
287 |
static YCPValue |
| 271 |
f_tolstring (const YCPFloat &f, const YCPInteger &precision) |
288 |
f_tolstring (const YCPFloat &f, const YCPInteger &precision) |
|
Lines 289-295
Link Here
|
| 289 |
ss.imbue (std::locale ("")); |
306 |
ss.imbue (std::locale ("")); |
| 290 |
ss.precision (precision->value ()); |
307 |
ss.precision (precision->value ()); |
| 291 |
ss << fixed<< f->value (); |
308 |
ss << fixed<< f->value (); |
| 292 |
YCPString ret (ss.str ()); |
309 |
YCPString ret (nbsp_fixed_string (ss.str ())); |
| 293 |
|
310 |
|
| 294 |
return ret; |
311 |
return ret; |
| 295 |
} |
312 |
} |