Skip to content

Commit

Permalink
Extend handle_printf_atsign() to output unicode in wprintf
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22431 72102866-910b-0410-8b05-ffd578937521
  • Loading branch information
rfm committed Feb 5, 2006
1 parent 974d119 commit 0bff224
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2006-02-05 Richard Frith-Macdonald <rfm@gnu.org>

* Source/NSString.m: (handle_printf_atsign()) extend to support wprintf.

2006-02-01 Richard Frith-Macdonald <rfm@gnu.org>

* Source/Additions/Unicode.m: Try to use iconv transliteration for
Expand Down
17 changes: 14 additions & 3 deletions Source/NSString.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <wchar.h>

#include "GNUstepBase/Unicode.h"

Expand Down Expand Up @@ -446,9 +447,19 @@ @implementation NSString
#else
string_object = *((id*) ptr);
#endif
len = fprintf(stream, "%*s",
(info->left ? - info->width : info->width),
[[string_object description] lossyCString]);
if (info->wide)
{
len = fwprintf(stream, L"%*ls",
(info->left ? - info->width : info->width),
[[string_object description]
cStringUsingEncoding: NSUnicodeStringEncoding]);
}
else
{
len = fprintf(stream, "%*s",
(info->left ? - info->width : info->width),
[[string_object description] lossyCString]);
}
return len;
}
#endif /* HAVE_REGISTER_PRINTF_FUNCTION */
Expand Down

0 comments on commit 0bff224

Please sign in to comment.