Solved

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

Posted on 2003-11-04
6
528 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 20 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

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…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

627 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