• 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: How to display Japanese in debug console?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to display Japanese in debug console?


  • Subject: Re: How to display Japanese in debug console?
  • From: "A.M." <email@hidden>
  • Date: Mon, 26 Jun 2006 11:35:53 -0400 (EDT)

On Mon, June 26, 2006 11:21 am, Steve Checkoway wrote:
>

> On Jun 26, 2006, at 6:17 AM, Norio Ota wrote:
>
>>
>> ----------------  CocoaFunctions.h  ----------------
>>
>>
>> #include <Carbon/Carbon.h>
>> #include <Cocoa/Cocoa.h>
>>
>>
>> extern void DebugStringInJP ( CFStringRef cfStr );
>>
>> ----------------  CocoaFunctions.m  ----------------
>> #import "CocoaFunctions.h"
>>
>>
>> void DebugStringInJP ( CFStringRef cfStr ) {
>> NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>> NSLog ((NSString*) cfStr);
>> [pool release];
>> }
>>
>
> First of all, if you're not using Cocoa for anything else, I wouldn't
> pull it in just for logging. Second, if I recall correctly, NSLog is
> variadic and as such you should probably write it as NSLog( @"%@", cfStr
> ). Third, why not just write your own?
>
>
> (Typed in mail while drunk.)
> void CFLog( CFStringRef fmt, ... ) {
> va_list ap; va_start( ap, fmt ); CFStringRef str =
> CFStringCreateWithFormatAndArguments( NULL, NULL,
> fmt, ap ); CFIndex length = CFStringGetLength( str );
> UInt32 encoding = kCFStringEncodingUTF8;
> CFIndex size = CFStringGetMaximumSizeForEncoding(length, encoding) + 1;
> char *buffer = (char *)malloc( size );
>
> CFStringGetCString( str, buffer, size, encoding );
> fputs( buffer, stderr ); // or stdout CFRelease( str );
> free( buffer ); }

All good advice, but why not simply use CFShow()?
http://gemma.apple.com/documentation/CoreFoundation/Reference/CFTypeRef/Reference/reference.html#//apple_ref/c/func/CFShow
-M

 _______________________________________________
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: How to display Japanese in debug console?
      • From: Damien Bobillot <email@hidden>
References: 
 >How to display Japanese in debug console? (From: Norio Ota <email@hidden>)
 >Re: How to display Japanese in debug console? (From: Damien Bobillot <email@hidden>)
 >Re: How to display Japanese in debug console? (From: Damien Bobillot <email@hidden>)
 >Re: How to display Japanese in debug console? (From: Norio Ota <email@hidden>)
 >Re: How to display Japanese in debug console? (From: Steve Sisak <email@hidden>)
 >Re: How to display Japanese in debug console? (From: Norio Ota <email@hidden>)
 >Re: How to display Japanese in debug console? (From: Chris Hanson <email@hidden>)
 >Re: How to display Japanese in debug console? (From: Norio Ota <email@hidden>)
 >Re: How to display Japanese in debug console? (From: Steve Checkoway <email@hidden>)

  • Prev by Date: Re: How to display Japanese in debug console?
  • Next by Date: Re: How to display Japanese in debug console?
  • Previous by thread: Re: How to display Japanese in debug console?
  • Next by thread: Re: How to display Japanese in debug console?
  • Index(es):
    • Date
    • Thread