Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6383663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:40:39+00:00 2026-05-25T02:40:39+00:00

I have scandinavian alphabets in my array like æ, ø, å. With NSLog the

  • 0

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.

I tried only:

NSArray *nnoWords = [[NSArray arrayWithArray:newNoWords] retain];
NSLog (@"nnoWords: %@ ", nnoWords);

newNoWords is a NSMutableArray. nnoWords containt normal objects like NSString hello, pear, apple, etc. taken from a txt file.


EDIT 29 august 2011:

nnoWords comes from this, converted to NSMutable and then back to NSArray, thus called nnoWords. And words.txt is encoded in UTF8.

     NSArray *noWords = [[NSArray alloc] initWithArray:
        [[NSString stringWithContentsOfFile:[[NSBundle mainBundle] 
    pathForResource:@"words" ofType:@"txt"]                                         
encoding:NSUTF8StringEncoding error:NULL] componentsSeparatedByString:@"\n"]];

I have also tried:

NSString *norsk = @"æ ø å";
    NSLog (@"%@", norsk);

And the output is correct:

2011-08-29 13:15:23.302 scanner2[29776:207] æ ø å
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:40:39+00:00Added an answer on May 25, 2026 at 2:40 am

    The problem is the Xcode console. If you view the output from Terminal.app, you will see it is as expected.

    Test case:

    //clang -framework Foundation -o log_utf8 log_utf8.m
    #import <Foundation/Foundation.h>
    
    int
    main(void)
    {
      NSString *word = @"en ord på Svenska";
      NSLog(@"%@", word);
    }
    

    Sample output:

    StackOverflow$ clang -framework Foundation log_utf8.m -o log_utf8
    StackOverflow$ ./log_utf8 
    2011-08-28 20:10:09.268 log_utf8[65105:707] en ord på Svenska
    

    If you are still seeing gibberish when you view the output from something other than Xcode’s questionable built-in console, then you need to examine how you’re getting your string data:

    • How does the text with non-ASCII characters enter your application?
    • What encoding does NSString think that text is in?
    • What encoding is it actually in? If the text comes from a file, then the file command might be able to answer this for you.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution
**Have it working now. I forgot to populate the Array List. How embarrassing. I'm
have some headers like: HTTP/1.1 100 Continue HTTP/1.1 302 Found HTTP/1.1 200 OK HTTP/1.1
Have advancements in CPU design like dynamic instruction scheduling narrowed the performance gap between
have an an array String classname[]={'a','b','c','d'}; ArrayAdapter<CharSequence> adapterClasses = new ArrayAdapter<CharSequence>( getApplicationContext(), R.layout.spinner_item_class, R.id.spinnerclasstxt,
Have any one tried to activate fancybox thumbnail gallery using a button or an
have different files with same name, in different directories. In these files there are
I have some lovely (Scandinavian?) user on my website complaining that I cannot parse
I have an array of names which I am reading in from a mysql

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.