mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-20 20:03:51 +00:00
Fixed invalid UTF-8 sequences being generated by wstring_to_utf8,
causing display bugs with some accented characters on some platforms. Changed portable_isspace() so it only returns true on ASCII spaces.
This commit is contained in:
parent
10992d045a
commit
444dc086e4
@ -43,6 +43,9 @@ bool isnewline(char c)
|
||||
//and they will work, by making sure the definition of whitespace is consistent
|
||||
bool portable_isspace(char c)
|
||||
{
|
||||
// returns true only on ASCII spaces
|
||||
if((unsigned char)c >= 128)
|
||||
return false;
|
||||
return isnewline(c) || isspace(c);
|
||||
}
|
||||
|
||||
|
@ -210,6 +210,7 @@ std::string wstring_to_utf8(const wide_string &src)
|
||||
} else {
|
||||
for(j = count-1; j >= 0; --j) {
|
||||
unsigned char c = (ch >> (6*j)) & 0x3f;
|
||||
c |= 0x80;
|
||||
if(j == count-1)
|
||||
c |= 0xff << (8 - count);
|
||||
push_back(ret,c);
|
||||
|
Loading…
x
Reference in New Issue
Block a user