Re: Re: [Q] How can I repair file name with wrong encoding?
Re: Re: [Q] How can I repair file name with wrong encoding?
- Subject: Re: Re: [Q] How can I repair file name with wrong encoding?
- From: "S.J.Chun" <email@hidden>
- Date: Thu, 13 Mar 2008 14:27:59 +0900
Hi,
I've used this code, but it does not work;
if ([self canBeConvertedToEncoding:_KoreanInWindows]) {
NSData *newData = [self dataUsingEncoding:_KoreanInWindows];
NSString *newString = [[NSString alloc] initWithData:newData encoding:_KoreanInWindows];
return [newString autorelease];
}
It seems that when Finder unzips the zip file from Windows(which
have files of CP949 encoded filename), it does not make unzipped
file name as byte-by-byte equally as CP949; it does use some kind
of unknown transformation of encoded name. For example original
file A has name "CP949NAME", after unzip it has name "UNKNOWNAME".
So I cannot directly convert from CP949 to UTF-8. I have to reconstrcut
"CP949NAME" from "UNKNOWNAME". (CP949NAME and UNKNOWNAE" is
just example not real case :-).
Thanks in advance.
----- Original Message -----
From: Kyle Sluder <email@hidden>
To: ""S.J.Chun"" <email@hidden>
Cc: Cocoa List <email@hidden>
Sent: 08-03-13 14:10:15
Subject: Re: [Q] How can I repair file name with wrong encoding?
On Thu, Mar 13, 2008 at 12:40 AM, "S.J.Chun" <email@hidden> wrote:
> For example, a file in zip archive from Windows(Korean), the file name
> will have CP949 encoding. If I unzip this file the file name looks weird as
> you already expected. How can I repair the name of file?
Are you looking to do this in code? You can use the NSString encoding
options to convert the CP949 string into a UTF-8 string, and then
rename the file using NSWorkspace.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden