mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
improive handling of failed character conversion
This commit is contained in:
parent
113867e9e6
commit
ab670fd27a
2 changed files with 3 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
* Source/Additions/Unicode.m: ensure iconv handle is closed
|
||||
* Source/NSLocale.m: localeIdentifierFromComponents should cope with
|
||||
collation alone beng set.
|
||||
* Source/GSString.m: better handling if character conversion fails.
|
||||
|
||||
2018-01-26 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -2120,6 +2120,7 @@ characterAtIndex_c(GSStr self, unsigned index)
|
|||
unsigned int s = 1;
|
||||
unichar *d = &u;
|
||||
|
||||
u = 0; // If conversion fails we use zero
|
||||
GSToUnicode(&d, &s, &c, 1, internalEncoding, 0, 0);
|
||||
}
|
||||
return u;
|
||||
|
@ -3414,6 +3415,7 @@ rangeOfCharacter_c(GSStr self, NSCharacterSet *aSet, unsigned mask,
|
|||
unsigned int s = 1;
|
||||
unichar *d = &u;
|
||||
|
||||
u = 0; // If conversion fails, we use zero
|
||||
GSToUnicode(&d, &s, &c, 1, internalEncoding, 0, 0);
|
||||
}
|
||||
/* FIXME ... what about UTF-16 sequences of more than one 16bit value
|
||||
|
|
Loading…
Reference in a new issue