bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fonts and mostCompatibleEncodig


From: Alexander Malmberg
Subject: Re: fonts and mostCompatibleEncodig
Date: Tue, 16 Apr 2002 14:48:29 +0200

> > Also there is a patch from Alexander Malmberg about
> > transmute() in GSString.m.
> 
> Can you tell me what this patch is supposed to achieve? As far
> as I can see, it simply makes the code a bit less efficient
> without providing any benfit, but presumably it is intended to
> fix some problem.  I'd like to know what that problem is.

The problem is that in this case (ie. we are an 8-bit string, the other
string is a valid 8-bit string in intEnc but we can't access its ivars),
-replaceCharactersInRange:withString: and -setString: try to use
getCString: directly into their own _contents.c. This will only work if
intEnc==defEnc (otherwise the string it puts in _contents.c will be in
the wrong encoding, though most of the time there's an exception in
getCString: instead).

Also, it seems that the check for strict in Unicode.m, GSFromUnicode(),
the tables: case, is inverted. I've attached a patch.

To catch things like this, I'd suggest running the tests with three
different string encodings, eg.:

GNUSTEP_STRING_ENCODING=NSISOLatin1StringEncoding make check
GNUSTEP_STRING_ENCODING=NSISOLatin2StringEncoding make check
GNUSTEP_STRING_ENCODING=NSISOCyrillicStringEncoding make check

Latin1 would be the 'normal' case (intEnc=defEnc=latin1), latin2 has
intEnc=defEnc=latin2, and cyrillic has intEnc=latin1, defEnc=cyrillic.
This should cover most cases.

- Alexander Malmberg
Index: Unicode.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/Unicode.m,v
retrieving revision 1.45
diff -u -r1.45 Unicode.m
--- Unicode.m   25 Mar 2002 14:11:39 -0000      1.45
+++ Unicode.m   14 Apr 2002 21:44:31 -0000
@@ -1963,7 +1963,7 @@
 #endif
 
 tables:
-       if (strict == YES)
+       if (strict == NO)
          {
            while (spos < slen)
              {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]