Re: Security Update 2005-006 and -[NSString length]
Re: Security Update 2005-006 and -[NSString length]
- Subject: Re: Security Update 2005-006 and -[NSString length]
- From: Bob Ippolito <email@hidden>
- Date: Fri, 17 Jun 2005 09:52:24 -0400
It's not legitimate to put unicode literals in Objective-C source
code. Try something like this instead of @"…".
const unichar HORIZONTAL_ELLIPSIS = 0x2026;
then later:
[NSString stringWithCharacters:&HORIZONTAL_ELLIPSIS length:1];
-bob
On Jun 17, 2005, at 9:35 AM, Christian Schneider wrote:
On second thought, the reason for our problems might also be that the
string @"..." (alt-.) from our source code results in ,Ä# (where # is
actually the symbol use to represent paragraph endings in text
editors, you know that thing looking vaguely like a p). The source
file is encoded in utf-8 as both XCode 2.1 and file tell me. In any
case it worked before installing the Security Update.
chris
On 6/17/05, Christian Schneider <email@hidden> wrote:
Hi all,
we have the following code where the three dots should actually be
one
Unicode character (alt-.). The code shortens a string by replacing
the
last two characters with "..." as long as the width needed to draw
the
string exceeds some reference width.
while( tmpSize.width > myWidth )
{
[tmpString replaceCharactersInRange:NSMakeRange([tmpString
length]-2,2) withString:@"..."];
tmpSize = [tmpString sizeWithAttributes:attributes];
}
Now, this code worked perfectly well until we installed Security
Update 2005-006. Since then, when a string that is too large to fit
comes in, it will actually be enlarged, the above code resulting
in an
infinite loop.
When I replace "alt-." with a simple space the code continues to
work.
The definition of -[NSString length] clearly states "Returns the
number of Unicode characters in the receiver." so I guess our
usage of
it should be correct.
Does anyone know what actually changed with the update (there's
nothing in the release notes) and if there's an equivalent way to get
what we want?
Thanks
chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden