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 PROTECTED]>
   To: ""S.J.Chun"" <[EMAIL PROTECTED]>
   Cc: Cocoa List <cocoa-dev@lists.apple.com>
   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 PROTECTED]> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to