• 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: converting / reading input arguments as utf8
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: converting / reading input arguments as utf8


  • Subject: Re: converting / reading input arguments as utf8
  • From: Clark Cox <email@hidden>
  • Date: Thu, 2 Feb 2006 12:42:03 -0500

On 2/2/06, koen gogne <email@hidden> wrote:
> Hi all,
>
> i'm quite new to cocoa programming,
> and i have a question on the use of utf8 input arguments
>
> Below you'll find some code that creates a thumbnail
> per page for a given input file to a given output location
>
> this workes fine as long as the input given does simple ascii characters
>
> once i try using utf8 characters my input gets transferred incorrectly,
> and the input file is not found and hence not read correctly,
> so no thumbs could be made.
>
> an example:
> this works perfectly:
> /Users/demo/myprogram /Volumes/vol1/input/file.pdf /Volumes/vol1/output/out
>
> this gets scrambled incorrectly:
> /Users/demo/myprogram /Volumes/vol1/ïnpût/filé.pdf /Volumes/vol1/output/out
>
> my code:
>
>
> int main (int argc, const char *argv[])
> {
>         NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>         NSLog([[NSString alloc] initWithFormat:@"Processing file '%s' to '%s'.",argv[1], argv[2]]);
>         NSString *inpath;
>         NSString *outpath;
>
>         inpath = [[[NSString alloc] initWithFormat:@"%s",argv[1]]  stringByExpandingTildeInPath];

Why are you using initWithFormat here? Why not:

inpath = [NSString stringWithUTF8String: argv[1]]?

--
Clark S. Cox III
email@hidden
My CV/Resume:
http://homepage.mac.com/clarkcox3/files/Resume.pdf
http://homepage.mac.com/clarkcox3/files/Resume.html
 _______________________________________________
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: 
 >converting / reading input arguments as utf8 (From: "koen gogne" <email@hidden>)

  • Prev by Date: Re: Linking Problem with 10.3.9 sdk
  • Next by Date: Re: cd
  • Previous by thread: Re: converting / reading input arguments as utf8
  • Next by thread: Fix and continue error (invalid precompiled header)
  • Index(es):
    • Date
    • Thread