• 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: PB Save As ASCII?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PB Save As ASCII?


  • Subject: Re: PB Save As ASCII?
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 14 Feb 2002 21:46:43 +0100

Todd,

>>>>>> Todd Blanchard (TB) wrote at Thu, 14 Feb 2002 09:22:12 -0800:
TB> This sucks. I'm going to have to retype the whole 2 pages of code by
TB> hand because no utility I can find will save the text as lossy ascii.

Although I completely share your sentiment of things which are so foolproof
to be actually next to unuseable, I guess you could do this in *considerably*
shorter time:

24 /tmp> cat > q.m
#import <Foundation/Foundation.h>
void main() {
id p=[NSAutoreleasePool new];
id d=[NSData dataWithContentsOfFile:@"contacts.vcf"];
id s=[[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding];
d=[s dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
[d writeToFile:@"/tmp/contacts.vcf" atomically:NO];
}
25 /tmp> cc -framework Foundation q.m && ./a.out
q.m: In function `main':
q.m:2: warning: return type of `main' is not `int'
26 /tmp>

using, of course, the name of your offending file and appropriate encoding
instead of mine "contacts.vcf" and NSUTF8StringEncoding which I used so as
the test did anything for real...

And naturally, if your file is saveable into any one-byte encoding (say, ISO
L2), you can use much simpler "tr -d '\200-\377' < infile > outfile" in a
fraction of even those few minutes needed for the above ;))))
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >PB Save As ASCII? (From: "Todd Blanchard" <email@hidden>)

  • Prev by Date: Drawer contents still active when sheet presented
  • Next by Date: Re: Sockets documentation?
  • Previous by thread: Re: PB Save As ASCII?
  • Next by thread: Re: PB Save As ASCII?
  • Index(es):
    • Date
    • Thread