mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Fix for unicode data returned as cstring.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21199 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d5e0804ab0
commit
04bfaf2fb5
3 changed files with 31 additions and 3 deletions
|
@ -2849,7 +2849,16 @@ handle_printf_atsign (FILE *stream,
|
|||
format: @"unable to convert to cString"];
|
||||
}
|
||||
m = [d mutableCopy];
|
||||
[m appendBytes: "" length: 1];
|
||||
if (encoding == NSUnicodeStringEncoding)
|
||||
{
|
||||
unichar c = 0;
|
||||
|
||||
[m appendBytes: &c length: 2];
|
||||
}
|
||||
else
|
||||
{
|
||||
[m appendBytes: "" length: 1];
|
||||
}
|
||||
AUTORELEASE(m);
|
||||
return (const char*)[m bytes];
|
||||
}
|
||||
|
@ -2974,6 +2983,10 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
if (len > maxLength) len = maxLength;
|
||||
memcpy(buffer, [d bytes], len);
|
||||
if (encoding == NSUnicodeStringEncoding)
|
||||
{
|
||||
buffer[len++] = '\0';
|
||||
}
|
||||
buffer[len] = '\0';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue