View | Details | Raw Unified | Return to bug 683881
Collapse All | Expand All

(-)libycp/src/YCPBuiltinFloat.cc (-1 / +18 lines)
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
}
(-)libycp/testsuite/tests/builtin/Builtin_VIII.out (-1 / +1 lines)
Lines 22-28 Link Here
22
("1.02")
22
("1.02")
23
("1,02")
23
("1,02")
24
("1024.09")
24
("1024.09")
25
("1Â024,09")
25
("1 024,09")
26
(true)
26
(true)
27
(true)
27
(true)
28
(true)
28
(true)

Return to bug 683881