all groups > dotnet sdk > september 2004 >
You're in the

dotnet sdk

group:

Ascii --> UTF8 and Excel trouble


Ascii --> UTF8 and Excel trouble slidell4life NO[at]SPAM gmail.com
9/13/2004 10:04:39 PM
dotnet sdk:
I'm having trouble with an ascii character...

°

....getting turned into ...

°

....when I write it to a file and open in Excel. It looks fine in
notepad, but excel mucks it up. I can only guess it's a Ascii to UTF8
problem.

Does anyone have any idea, or perhaps a lesson on strings they'd like
to share?

Thanks,
Re: Ascii --> UTF8 and Excel trouble Joerg Jooss
9/14/2004 8:03:09 AM
[quoted text, click to view]

This is not an ASCII character (ASCII is only 7 bit). It is probably from an
8 bit extension of ASCII such as Windows-1252 or ISO-8859-1. Can you post
your code?

Cheers,

--
Joerg Jooss
joerg.jooss@gmx.net

Re: Ascii --> UTF8 and Excel trouble **Code Included** slidell4life NO[at]SPAM gmail.com
9/16/2004 10:01:58 PM
Yes. It's UTF8 encoding, I beleive. Here is my code:

class Class1
{
public static void Main(string[] args)
{
string degree = ("°");
string sFile = "testingAscii.csv";
System.IO.StreamWriter writer =
System.IO.File.CreateText(sFile);

try
{
writer.Write(degree);
}
finally
{
writer.Close();
}
System.Diagnostics.Process.Start(sFile);
}
}


Re: Ascii --> UTF8 and Excel trouble **Code Included** Hans
9/23/2004 6:49:07 AM
try

System.IO.StreamWriter writer = new StreamWriter(sFile,
System.Text.Encoding.Default);

By using System.Text.Encoding.Default, the writer will use the system's
current ASNI code page.

Hans

[quoted text, click to view]
AddThis Social Bookmark Button