Re: printf functions fail with non-ascii characters
Re: printf functions fail with non-ascii characters
- Subject: Re: printf functions fail with non-ascii characters
- From: "Shawn Erickson" <email@hidden>
- Date: Wed, 5 Sep 2007 10:49:39 -0700
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?
What encoding are using using for the file that contains main? Using
mulit-byte characters directly in source code is fragile and not
always supported.
-Shawn
_______________________________________________
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