Click here to Skip to main content
15,890,527 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Custom Collection Pin
CodingYoshi18-Feb-08 16:51
CodingYoshi18-Feb-08 16:51 
GeneralRe: Custom Collection Pin
darkelv18-Feb-08 17:01
darkelv18-Feb-08 17:01 
GeneralRe: Custom Collection Pin
Patrick Etc.18-Feb-08 18:54
Patrick Etc.18-Feb-08 18:54 
GeneralCustomizing web part title border in MOSS 2007. Pin
sdklfjlkdsfjdklsfjkdslfjdslkf18-Feb-08 2:58
sdklfjlkdsfjdklsfjkdslfjdslkf18-Feb-08 2:58 
QuestionECDsaCng elliptic curve class produces exception on import of private key Pin
Steve_K17-Feb-08 23:40
Steve_K17-Feb-08 23:40 
GeneralAdding new syntax highlighting Pin
barbq200017-Feb-08 2:55
barbq200017-Feb-08 2:55 
GeneralRe: Adding new syntax highlighting Pin
Pete O'Hanlon17-Feb-08 10:25
mvePete O'Hanlon17-Feb-08 10:25 
GeneralStreamWriter.WriteLine converting hex A0 to hex EF BF BD Pin
Mike Bluett16-Feb-08 13:46
Mike Bluett16-Feb-08 13:46 
In 2006, I wrote a C# app (using .NET 2.0 in VS 2005 Express) which was designed to add some PHP code to several HTML files. The HTML files are encoded as ISO 8859-1.

This application worked fine until around Nov 2007 when some unknown change occurred in my Windows XP installation which resulted in hex A0 (&nbsp in html) being converted to hex EF BF BD.

I have since found info which states that an illegal character will be recoded as EF BF BD. However, A0 is a LEGAL character in ISO 8859-1 encoding.

In trying to resolve this problem I have tried all of the StreamWriter class Encoding options and have also completely uninstalled VS 2005 and all .NET SDK's and runtime and then subsequently installed .NET 3.5 SDK's (which includes the latest 2.0 SDK) and runtimes and also C# VS 2008. None of these actions resolved the problem.

Any ideas on how to prevent this conversion from occurring?

The code sequence which makes use of StreamWriter.WriteLine is as follows:

<code> private void Process_Files()
{
const bool OVERWRITE = true;
const bool APPEND = true;
ArrayList file_array = new ArrayList();
string newString;
bool found = false;

foreach (string fileName in fileList)
{
Console.WriteLine("Processing: " + fileName + ".htm");

// Add PHP authentication info to top of file
FileInfo srcFile = new FileInfo("PHP-Auth.txt");
srcFile.CopyTo(HTM_FILE_PATH + "temp.php", OVERWRITE);

StreamReader htmFile = new StreamReader(HTM_FILE_PATH + fileName + ".htm");
StreamWriter tmpFile = new StreamWriter(HTM_FILE_PATH + "temp.php", APPEND);

// Read the entire .htm file into memory.
while (!htmFile.EndOfStream)
{
file_array.Add(htmFile.ReadLine());
}
htmFile.Close();

// Append a blank line to the end of the temp.php file.
tmpFile.WriteLine();
tmpFile.WriteLine();

// Process each line of the .htm file.
foreach (string line in file_array)
{
// Compare each name in the fileList to each line of this particular
// .htm file.
foreach (string name in fileList)
{
// If this line of the file contains one of the filenames in "fileList"
// with an extension of .htm, replace it with an extension of .php, with
// the exception of a line that contains "family.htm".
if (line.Contains(name + ".htm") && !line.Contains("family.htm"))
{
found = true;
break;
}
}

if (found)
{
newString = line;
newString = newString.Replace(".htm", ".php");
tmpFile.WriteLine(newString);
found = false;
}
else
// Use the existing line.
tmpFile.WriteLine(line);
}
tmpFile.Close();
file_array.Clear();
// Rename the temp file to it's final .php name.
File.Move(HTM_FILE_PATH + "temp.php", HTM_FILE_PATH + fileName + ".php");
// Delete the old .htm filename.
File.Delete(HTM_FILE_PATH + fileName + ".htm");
}
}</code>
GeneralRe: StreamWriter.WriteLine converting hex A0 to hex EF BF BD Pin
Guffa17-Feb-08 4:22
Guffa17-Feb-08 4:22 
GeneralRe: StreamWriter.WriteLine converting hex A0 to hex EF BF BD Pin
Mike Bluett17-Feb-08 8:13
Mike Bluett17-Feb-08 8:13 
GeneralRe: StreamWriter.WriteLine converting hex A0 to hex EF BF BD Pin
Guffa17-Feb-08 10:11
Guffa17-Feb-08 10:11 
GeneralDataGridTableStyle equivalent for DataGridView Pin
keniagm15-Feb-08 7:40
keniagm15-Feb-08 7:40 
GeneralRe: DataGridTableStyle equivalent for DataGridView Pin
led mike15-Feb-08 7:56
led mike15-Feb-08 7:56 
GeneralRe: DataGridTableStyle equivalent for DataGridView Pin
keniagm15-Feb-08 8:07
keniagm15-Feb-08 8:07 
GeneralRe: DataGridTableStyle equivalent for DataGridView Pin
led mike15-Feb-08 8:15
led mike15-Feb-08 8:15 
GeneralRe: DataGridTableStyle equivalent for DataGridView Pin
keniagm15-Feb-08 8:27
keniagm15-Feb-08 8:27 
GeneralRe: DataGridTableStyle equivalent for DataGridView Pin
led mike15-Feb-08 9:05
led mike15-Feb-08 9:05 
GeneralRe: DataGridTableStyle equivalent for DataGridView Pin
keniagm15-Feb-08 9:20
keniagm15-Feb-08 9:20 
GeneralRe: DataGridTableStyle equivalent for DataGridView Pin
Member 1190124510-Mar-21 18:29
Member 1190124510-Mar-21 18:29 
GeneralRe: DataGridTableStyle equivalent for DataGridView Pin
Richard Deeming10-Mar-21 21:30
mveRichard Deeming10-Mar-21 21:30 
Question[Message Deleted] Pin
Ippacciani15-Feb-08 7:40
Ippacciani15-Feb-08 7:40 
GeneralRe: hashTable Pin
led mike15-Feb-08 8:04
led mike15-Feb-08 8:04 
GeneralRe: hashTable Pin
Kevin McFarlane15-Feb-08 10:45
Kevin McFarlane15-Feb-08 10:45 
GeneralRe: [Message Deleted] Pin
Luc Pattyn16-Feb-08 7:12
sitebuilderLuc Pattyn16-Feb-08 7:12 
GeneralSorted list Pin
KeesVer14-Feb-08 3:09
KeesVer14-Feb-08 3:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.