root/branches/perian-1.1/UniversalDetector/DetectorTest.m

Revision 406, 508 bytes (checked in by astrange, 2 years ago)

Use the (LGPL) Mozilla automatic charset detection library for external subtitles.
Unfortunately, it's quite large...
References #87

Line 
1 #import <Cocoa/Cocoa.h>
2 #import <UniversalDetector/UniversalDetector.h>
3
4 int main(int argc,char **argv)
5 {
6         NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
7
8         UniversalDetector *detector=[UniversalDetector detector];
9
10         for(int i=1;i<argc;i++)
11         {
12                 NSData *data=[NSData dataWithContentsOfFile:[NSString stringWithUTF8String:argv[i]]];
13                 [detector analyzeData:data];
14         }
15
16         printf("%s %d %f\n",[[detector MIMECharset] UTF8String],[detector encoding],[detector confidence]);
17
18         [pool release];
19         return 0;
20 }
Note: See TracBrowser for help on using the browser.