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 8170683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:12:23+00:00 2026-06-06T21:12:23+00:00

I wrote a android app in java to get user answers and save them

  • 0

I wrote a android app in java to get user answers and save them in a file.
The problem is that this file is saved in utf-8.
The end user will open these files in the IBM SPSS, an application for windows that can read files only in ANSI (windows-1252).

How do I create files in ANSI code to save in a SD card from java-android app?

I think I know that to convert Strings to ANSI I should use:

String unicode = new String(asciiBytes, "windows-1252");

Is that correct?

My code to save the file is this:

File interviewFile = new File(placeOfSDD, fileName);
FileWriter writer = new FileWriter(interviewFile, true);
writer.append(textBody);
writer.flush();
writer.close();

"textBody" is the String to convert to ANSI, and the "interviewFile" is the file to be saved as ANSI too.

Thanks for the help!!

  • 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-06-06T21:12:24+00:00Added an answer on June 6, 2026 at 9:12 pm

    Strings are represented within the JVM as Unicode. When you write it out, you need to convert it to an appropriate character set.

    To do this, use an OutputStreamWriter and specify the Charset.

    OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file, true), 
                                                       "windows-1252");
    writer.append(textBody);
    writer.close();
    

    Regarding your first question:

    I think I know that to convert Strings to ANSI I should use:
    String unicode = new String(asciiBytes, "windows-1252");
    Is that correct?

    Given an array of bytes representing characters in the ‘windows-1252’ character set, this code will construct you the appropriate Java String (internally represented as Unicode within the JVM). This isn’t “converting Strings to ANSI” … it’s doing the opposite: converting ‘windows-1252’ to Unicode.

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

Sidebar

Related Questions

I am attempting to develop an Android app that allows a user to write
I have successfully implemented this from android to a java httpservlet on google app
I am working on this code, and inside my first .java file I get
I wrote code to make get request on Android, but I error like this:
I wrote an Android App using the Mixare ( link to mixare project )
I wrote an android app for someone, but they want the source code because
I am trying to learn Android app development and wrote a very simple app
I am working on an app for android using phonegap and unity. I wrote
I want to write a small Android app with a GUI that should display
Suppose I want to write an app for Android OS that is not going

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.