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

  • Home
  • SEARCH
  • 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 6553415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:34:44+00:00 2026-05-25T12:34:44+00:00

I having problem using CHCSVwriter to export my arrays to CSV or excel file.

  • 0

I having problem using CHCSVwriter to export my arrays to CSV or excel file.

I have several Arrays that are in Persian language ( it’s localized and this must be UTF-8, at least in windows ).

With using CHCSVWriter ( thanks, Dave ) I am able to do export my arrays into CSV file BUT not with default settings.

Because of my array encodings ( UTF8 Did not work , I don’t know why !! ) but changing CHCSVwriter.m I am able to write the files with my localized language.

I have a strange Problem :

1- If I use NSUTF8StringEncoding then I have one standard Comma separated CSV file that is able to be opened with Excel very well with correct columns separation BUT table cells are in unknown encoding ( I am using persian language)

2- If I use NSUTF16StringEncoding then I have a CSV file that whole columns of each row writes into one column ! but the language and encoding is right ! the strange thing is that commas are NOT detectable for excel and it’s open a table with just One column that each row contains whole columns that I designed to be separated with commas that are existing there !!!

Also, I have another problem that I don’t find a way to set encoding for CHCSVWriter and I have to change it manually from CHCSVWriter.m file !
part of CHCSVWriter.m:

- (void)_writeString:(NSString *)string {
//  if (encoding == 0) {
//      encoding = NSUTF8StringEncoding;
        encoding = NSUTF16StringEncoding;
//}

And part of my code :

    NSString * tempFileName = [NSString stringWithFormat:@"sellExport.csv"];
    NSString * tempFile =[NSHomeDirectory() stringByAppendingPathComponent:tempFileName];

    NSLog(@"Writing to file: %@", tempFile);

    error = nil;
     CHCSVWriter *sellExporting = [[CHCSVWriter alloc] initWithCSVFile:tempFile atomic:NO];


    [sellExporting writeLine];
    for (int i = 0; i<=[purchaseCodes count] ; i++) {


        [sellExporting writeLineOfFields:[purchaseCodes objectAtIndex:i],[purchaseDates objectAtIndex:i],[purchaseCarBrands objectAtIndex:i],[purchaseCarSystems objectAtIndex:i],[purchaseCarModels objectAtIndex:i],[purchaseCarColors objectAtIndex:i],[purchaseCarChassis objectAtIndex:i],[purchaseCustomerNames objectAtIndex:i],[purchaseSharedNames objectAtIndex:i],[purchaseTotals objectAtIndex:i],[sellCodes objectAtIndex:i],[sellCustomerNames objectAtIndex:i],[sellDates objectAtIndex:i],[sellTotals objectAtIndex:i],[sellProfits objectAtIndex:i],[sellShareProfits objectAtIndex:i],nil];
        }
    [sellExporting closeFile];
    [sellExporting release];
  • 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-25T12:34:45+00:00Added an answer on May 25, 2026 at 12:34 pm

    As nobody could resolve my problem,

    I found that Unicode encoding is not very well supported with Microsoft Excell ( mac ).
    In other hand, because of this fact that I’m using Perisan language for my data entries so I have to use NSUTF16StringEncoding ( why UTF8StringEncoding didn’t work ? I don’t know !! ) and when I open the .csv file I have all my data in just one column ( I have 16 column ) and Microsoft Excell can not detect comma (,) as separation delimiter !!!

    Anyway, now, I am able to open the UTF16 Encoded CSV file using NeoOffice or OpenOffice that well supported Unicode .csv files without any problem !

    So, this all about Microsft not Dave deLong‘s CHCSVWriter. ( thank you Dave, Again )

    this my 5th question that I solved by myself !!!

    Thank you all anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem using a CSV file uploaded via a PHP form. Here
I am having a problem using the Unity Application Block, I have created a
I'm having a problem using deploy:deploy-file with snapshots I'd like some advice on please.
I'm having a problem using a package ADS file in Ada. I'm getting an
I having a problem on using Split Method() . I have a string like
I'm having a problem using custom components at runtime. I have this custom FlowLayoutPanel
I am having some problem using the clone function in jQuery. I have been
I'm having a problem using methods in my module's model class. I have a
I'm having a problem using WCF Data Services for an entity that has a
I'm having a problem using Make's wildcard function in my Android.mk build file. My

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.