• 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
Re: printf functions fail with non-ascii characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf functions fail with non-ascii characters


  • Subject: Re: printf functions fail with non-ascii characters
  • From: "Kyle Sluder" <email@hidden>
  • Date: Wed, 5 Sep 2007 13:51:10 -0400

The Xcode User Guide recommends that you only use low-ASCII characters
in source code. <
http://developer.apple.com/DOCUMENTATION/DeveloperTools/Conceptual/XcodeUserGuide/Contents/Resources/en.lproj/03_01_ed_file_attr/chapter_18_section_3.html
>

Your best alternative is to encode the characters as octals inside the string.

--Kyle Sluder

On 9/5/07, William H. Schultz <email@hidden> wrote:
>  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/
>
>
>  _______________________________________________
> 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
>
>
 _______________________________________________
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

References: 
 >printf functions fail with non-ascii characters (From: "William H. Schultz" <email@hidden>)

  • Prev by Date: Re: printf functions fail with non-ascii characters
  • Next by Date: Re: printf functions fail with non-ascii characters
  • Previous by thread: Re: printf functions fail with non-ascii characters
  • Next by thread: Re: printf functions fail with non-ascii characters
  • Index(es):
    • Date
    • Thread