title: objective-c how to encode NSArray with UTF8?
body: <p>I have scandinavian alphabets in my array like æ, ø, å. With NSLog the output showed these alphabets as scrambled codes. How to encode NSArray with UTF8? Any help is appreciated.</p>
  
  <p>I tried only: </p>
  
  <pre><code>NSArray *nnoWords = [[NSArray arrayWithArray:newNoWords] retain];
  NSLog (@"nnoWords: %@ ", nnoWords);
  </code></pre>
  
  <p>newNoWords is a NSMutableArray. nnoWords containt normal objects like NSString hello, pear, apple, etc. taken from a txt file.</p>
  
  <hr>
  
  <p>EDIT 29 august 2011:</p>
  
  <p>nnoWords comes from this, converted to NSMutable and then back to NSArray, thus called nnoWords. And words.txt is encoded in UTF8. </p>
  
  <pre><code>     NSArray *noWords = [[NSArray alloc] initWithArray:
          [[NSString stringWithContentsOfFile:[[NSBundle mainBundle] 
      pathForResource:@"words" ofType:@"txt"]                                         
  encoding:NSUTF8StringEncoding error:NULL] componentsSeparatedByString:@"\n"]];
  </code></pre>
  
  <p>I have also tried:</p>
  
  <pre><code>NSString *norsk = @"æ ø å";
      NSLog (@"%@", norsk);
  </code></pre>
  
  <p>And the output is correct:</p>
  
  <pre><code>2011-08-29 13:15:23.302 scanner2[29776:207] æ ø å
  </code></pre>