Skip navigation.
 
mlRe: Re: [Q] How can I repair file name with wrong encoding?
FROM : S.J.Chun
DATE : Thu Mar 13 06:27:59 2008

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 <kyle.sluder+<email_removed>>
  To: ""S.J.Chun"" <<email_removed>>
  Cc: Cocoa List <<email_removed>>
  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_removed>> 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

Related mailsAuthorDate
ml[Q] How can I repair file name with wrong encoding? S.J.Chun Mar 13, 05:40
mlRe: [Q] How can I repair file name with wrong encoding? Kyle Sluder Mar 13, 06:10
mlRe: Re: [Q] How can I repair file name with wrong encoding? S.J.Chun Mar 13, 06:27
mlRe: [Q] How can I repair file name with wrong encoding? Jens Alfke Mar 13, 06:42
mlRe: [Q] How can I repair file name with wrong encoding? Jens Alfke Mar 13, 15:48
mlRe: [Q] How can I repair file name with wrong encoding? Aki Inoue Mar 13, 22:52
mlRe: [Q] How can I repair file name with wrong encoding? John Stiles Mar 13, 22:56