• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
printf functions fail with non-ascii characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

printf functions fail with non-ascii characters


  • Subject: printf functions fail with non-ascii characters
  • From: "William H. Schultz" <email@hidden>
  • Date: Wed, 5 Sep 2007 10:40:59 -0700

I might be asking a silly question here, but I've been working with this for a few days, and I've narrowed my issues down to this:

The wide character versions of the printf functions are failing with various non-ascii characters, as can be seen with the following code:


#include <stdarg.h>
#include <wchar.h>

int main()
{
wchar_t buf[20];
va_list ap;
return vswprintf(buf, 20, L"トネヘ", ap);
}


In case the above doesn't properly survive the e-mail, that's just three random Japanese characters in the test string.  This code returns -1 instead of the 3 that I would expect by looking at it.  The same is true for various other sets of non-ascii characters and various other wide character printf functions.

I'm using Xcode 2.4.1 under 10.4.10 on an Intel machine.  This is with g++ version 4.0.1 (build 5367).


Any ideas?

-------------------------------
Hank Schultz
Cedrus Corporation
http://www.cedrus.com/


Attachment: PGP.sig
Description: This is a digitally signed message part

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: printf functions fail with non-ascii characters
      • From: Peter Mulholland <email@hidden>
    • Re: printf functions fail with non-ascii characters
      • From: Fritz Anderson <email@hidden>
    • Re: printf functions fail with non-ascii characters
      • From: "Kyle Sluder" <email@hidden>
    • Re: printf functions fail with non-ascii characters
      • From: "Shawn Erickson" <email@hidden>
  • Prev by Date: Re: -mlong-branch
  • Next by Date: Re: printf functions fail with non-ascii characters
  • Previous by thread: Re: -mlong-branch
  • Next by thread: Re: printf functions fail with non-ascii characters
  • Index(es):
    • Date
    • Thread