• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSStringEncoding troubles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSStringEncoding troubles


  • Subject: Re: NSStringEncoding troubles
  • From: Mike Shields <email@hidden>
  • Date: Sat, 13 Jul 2002 23:34:01 -0600

Actually, take this idea, and run with it by writing a category on NSString like

@interface NSString (IRCStringAdditions)

- (id)initWithIRCData:(NSData *)data encoding:(NSStringEncoding)encoding;

@end

and the implementation of this does the work of splitting on IRC control codes, encoding and recomposing the string properly. Then it's no extra work for your current code to handle it (other than the change to the new method name).

Mike


On Saturday, July 13, 2002, at 10:20 PM, Dan Crevier wrote:

On 7/13/2002 3:21 PM, "Adrian Rutledge" <email@hidden>
wrote:

I'm writing an IRC app at the moment, and while [[NSString alloc]
initWithData:bleh encoding:NSSomeStringEncoding] works, it escapes
non-printing values such as ASCII 02. IRC uses several of the low
non-printing ASCII values for control codes, bold, underlines, CTCP,
color, etc. I want to stick with using the Cocoa provided encoding and
decoding stuff, that will save me a good deal of work when I,
eventually, add support for the Japanese encodings. (Should make it
nearly free, right? I'll have to research that some, later.) In any
case, is there any hidden argument I can give NSString or the NSData
instance to make it preserve non-printing characters exactly as they are.

You could break your strings up into runs, broken on each IRC special token.
Then, convert the strings one run at a time.

Dan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: NSStringEncoding troubles (From: Dan Crevier <email@hidden>)

  • Prev by Date: Re: make a step-by-step wizard
  • Next by Date: Re: make a step-by-step wizard
  • Previous by thread: Re: NSStringEncoding troubles
  • Next by thread: Re: NSStringEncoding troubles
  • Index(es):
    • Date
    • Thread