On Wed, 2003-09-17 at 09:21, Yen-Ju Chen wrote: > > > > It doesn't work because in your patch, > the iEnc is set to NSUnicodeStringEncoding for "-EscapeIn Yes" case, > and this iEnc is immediately used to read the file, > which is in ASCII (local) encoding or Unicode encoding. > For the ASCII encoding, it fails. > The input file could be in Unicode encoding or local encoding (ASCII > actually). > That's the reason the if... in your patch is checking. > > So for "-EscapeIn Yes" and input file is in local encoding (ASCII), > it should read the file in iEnc encoding, convert \uXXXX into Unicode in > NSString, > then write this NSString using the iEnc again (line 234-238) > since the iEnc is the encoding of user environment. > > For "-EscapeIn Yes" and input file is Unicode, > using iEnc is still correct because input and output are all Unicode > encoding (iEnc). > > Hope my explanation is clear for you. >
Maybe I understand, but I think the else clause is for both eIn=YES and eIn=NO, so perhaps it should be this?
Index: Tools/cvtenc.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/base/Tools/cvtenc.m,v retrieving revision 1.4 diff -u -p -r1.4 cvtenc.m --- Tools/cvtenc.m 12 May 2003 20:42:47 -0000 1.4 +++ Tools/cvtenc.m 20 Sep 2003 02:38:23 -0000 @@ -229,6 +229,11 @@ main(int argc, char** argv, char **env) myData = [[NSData alloc] initWithBytesNoCopy: c length: o]; } + else if (eIn == YES) + { + myData = [myString dataUsingEncoding: iEnc + allowLossyConversion: NO]; + } else { myData = [myString dataUsingEncoding: oEnc
_______________________________________________ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep