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: Jim Hamilton <email@hidden>
- Date: Fri, 17 Jun 2005 09:45:47 -0400
On Jun 17, 2005, at 8:46 AM, Christian Schneider 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];
}
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.
Not sure if this is your problem, but your second note came while I
was typing, and suggests that it is. The result of putting the
ellipsis character in a @"" string is actually undefined. You're
only supposed to use ASCII characters there.
If your file encoding is UTF-8, you're just confusing the compiler.
In any case it worked before installing the Security Update.
... which means an implementation detail changed somewhere.
There are ways to get an ellipsis into an NSString: 1)
NSLocalizedString; 2) stringWithUTF8String:"..."; just put the
Unicode character (look it up) into an NSMutableString.
HTH,
Jim H
--
Jim Hamilton
email@hidden
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