Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to convert Apple mac text file,to a normal windows encoding

Posted on 2003-11-04
6
Medium Priority
?
530 Views
Last Modified: 2007-12-19
hi i want to read a file written on a mac os. could this be done
in c#
0
Comment
Question by:hema_jone_mickey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 15

Expert Comment

by:SRigney
ID: 9681558
If the file is saved in text format then yes it should be possible.

Apple only uses the either the Line Feed or Carriage Return character at the end of each line (not sure which one), while Windows uses Line Feed and Carriage Return, but other than that there shouldn't be a problem.
0
 

Author Comment

by:hema_jone_mickey
ID: 9681676
i used the following code
FileStream ReadPdf = new FileStream("c:\\test.txt", FileMode.Open);
                  long FileSize;
                  FileSize = ReadPdf.Length;
                  byte[] Buffer = new byte[(int)FileSize];
                  ReadPdf.Read(Buffer, 0, (int)ReadPdf.Length);

                  String str = System.Text.Encoding.Default.GetString(Buffer);

                        ReadPdf.Close();

but it's supposed it's Arabic ,it returned arabic words but no understandable

so what is the solution ,and what type to save the file in
and thanks
0
 

Author Comment

by:hema_jone_mickey
ID: 9681680
an dhow to do it  SRigney
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:SRigney
ID: 9682605
How did you get the file from the Apple into the Windows operating system?

Ftp is my preferred method.
0
 

Author Comment

by:hema_jone_mickey
ID: 9684730
i don't ask how to get the file ,i ask about the conversion to the readable format by windows .how to convert from C# Code the MAC FORMAT TO THE WINDOWS FORMAT?
0
 
LVL 15

Accepted Solution

by:
SRigney earned 40 total points
ID: 9686567
I know, but there's a difference between reading a MAC file from a Mac formatted floppy disk and getting the file via ftp.

On all MAC files that I have received the file is in ASCII format with the only difference between Windows being the end of the line using a single character instead of 2 characters.

Thus the simple code that you have already posted would work for every MAC file that I have ever received.

There's also an editor on the internet called UltraEdit32  http://www.ultraedit.com/
There is a conversion from UNIX/MAC to DOS that it uses, but again, it deals with replacing the single endline character with the 2  characters.   It will give you an editor that will show you the same thing that you should see in your code.

If the file that you have is not a simple text file, but a formatted file that was formatted by some Mac Editor such as Word then it will have additional formatting information other than simple text.  It's possible that you are just reading the formating information.  If that's the case then you won't be able to work around it within your code without knowing the entire formatting schema of the editor.  At that point the originator of the file will have to save it to a text only format and give you the file again.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question