PC Review


Reply
Thread Tools Rate Thread

Converting textfile from Mac to Windows

 
 
Jone
Guest
Posts: n/a
 
      18th Jun 2008
Hello,

I have tried to convert a Mac text file to Windows using code below.

Encoding Win = Encoding.GetEncoding("Windows-1252");

Encoding Mac = Encoding.GetEncoding("macintosh");

byte[] macBytes = Mac.GetBytes(Row);

byte[] WinBytes = Encoding.Convert(Mac, Win, macBytes);

char[] WinChars = new char[Win.GetCharCount(WinBytes, 0, WinBytes.Length)];

Win.GetChars(WinBytes, 0, WinBytes.Length, WinChars, 0);

string WinString = new string(WinChars);

return WinString;

But, it does not convert e.g. German and Scandinavian characters written in
Mac to proper format in Windows.
How can a textfile written in MAc could be converted into Windows
environment?

Cheers!


 
Reply With Quote
 
 
 
 
Joachim Van den Bogaert
Guest
Posts: n/a
 
      19th Jun 2008
I have experienced the problem of converting windows to mac.
We needed Word files for Mac 8.5 so what I did was the following:
First convert the text to rtf, then parse the rtf with a matrix I
composed from the official codepages you find here

http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/

I used this approach because there was something wrong with the
conversion in Word for Windows.
CE languages showed corrupted characters.

After I wrote the conversion tool, the files were ok for mac.

The text is plain ASCII so I suggest you have a look at the codepages
on the link I gave you
and do a hex dump of your file (rename it to a .bin file for example)
in Visual Studio so you can trace wrong characters.
Maybe then you can find out which code page has been used. If the
approach with the .NET codepages doesnt work
you can still use the matrix method,

Hope this helps,
Joachim

 
Reply With Quote
 
Jone
Guest
Posts: n/a
 
      19th Jun 2008

"Joachim Van den Bogaert" <(E-Mail Removed)> wrote in message
news:c8cd4d70-58bb-4671-a3ba-(E-Mail Removed)...
>I have experienced the problem of converting windows to mac.
> We needed Word files for Mac 8.5 so what I did was the following:
> First convert the text to rtf, then parse the rtf with a matrix I
> composed from the official codepages you find here
>
> http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/
>
> I used this approach because there was something wrong with the
> conversion in Word for Windows.
> CE languages showed corrupted characters.
>
> After I wrote the conversion tool, the files were ok for mac.
>
> The text is plain ASCII so I suggest you have a look at the codepages
> on the link I gave you
> and do a hex dump of your file (rename it to a .bin file for example)
> in Visual Studio so you can trace wrong characters.
> Maybe then you can find out which code page has been used. If the
> approach with the .NET codepages doesnt work
> you can still use the matrix method,
>
> Hope this helps,
> Joachim


Thank Joachim for your reply.
My case is following:

1. Filemaker should write a file to filesystem containig data from database.
2. C# / Asp.Net should read this file, parse it and insert data into SQL
Server.

Problem is that special characters that Filemaker writes into file are not
shown correctly in
Windows.

I have tried to encoding using C#'s Encoding classes but still special
characters are not shown.

Do you know that what is the default encoding when FileMaker writes data
into file?
Is it possible and how to change encoding so that Windows can also
understand it, maybe UTF8?

I would be very grateful for tips what comes to proper encoding between Mac
FileMaker and Windows.

Thanks,

- J


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a textfile to XML helmut Microsoft VB .NET 3 31st Dec 2004 03:22 PM
Textfile Praetorian Guard Microsoft Outlook Discussion 4 19th Jan 2004 02:08 PM
Textfile Praetorian Guard Microsoft Outlook 4 19th Jan 2004 02:08 PM
Problem in Converting from textfile to Worksheet Poornima Microsoft Excel Worksheet Functions 1 8th Oct 2003 06:47 AM
Textfile from Windows to Macintosh? Mats-Erik Grundh Microsoft Dot NET Framework 0 6th Sep 2003 04:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:43 AM.