Click here to Skip to main content
15,887,283 members
Home / Discussions / C#
   

C#

 
QuestionComparing various algorithms to convert GPS-coordinates to 2D-coordinates Pin
CrIpLeX24-Aug-10 11:09
CrIpLeX24-Aug-10 11:09 
AnswerRe: Comparing various algorithms to convert GPS-coordinates to 2D-coordinates Pin
Luc Pattyn24-Aug-10 11:38
sitebuilderLuc Pattyn24-Aug-10 11:38 
GeneralRe: Comparing various algorithms to convert GPS-coordinates to 2D-coordinates Pin
CrIpLeX25-Aug-10 2:00
CrIpLeX25-Aug-10 2:00 
GeneralRe: Comparing various algorithms to convert GPS-coordinates to 2D-coordinates Pin
Luc Pattyn25-Aug-10 2:27
sitebuilderLuc Pattyn25-Aug-10 2:27 
AnswerRe: Comparing various algorithms to convert GPS-coordinates to 2D-coordinates [modified] Pin
Peter_in_278024-Aug-10 11:39
professionalPeter_in_278024-Aug-10 11:39 
GeneralRe: Comparing various algorithms to convert GPS-coordinates to 2D-coordinates Pin
CrIpLeX25-Aug-10 2:01
CrIpLeX25-Aug-10 2:01 
AnswerRe: Comparing various algorithms to convert GPS-coordinates to 2D-coordinates Pin
Bernhard Hiller25-Aug-10 0:27
Bernhard Hiller25-Aug-10 0:27 
QuestionCharacter encoding when reading a text file of unknown encoding, to create an XML file Pin
JohnLBevan24-Aug-10 9:00
professionalJohnLBevan24-Aug-10 9:00 
Hi Guys,

I'm working on a project where I need to parse data coming from flat files into XML. All was working well until I was sent a csv file which contained a › character (nb: this is not a > (62), but › (155)). When this is written to my XML, it is displayed as a square box. I'd assumed that if I set the stream reader to automatically determine the file's encoding, and set the XML writer to use unicode, all character conversions would take place automatically, but it seems that either that's not the case, or I've missed something. Does anyone know what about the following code could cause extended characterset chars to not be correctly converted?

public XmlDocument ToXmlDocument(string filename, bool headerRow)
{
	string tempfile = System.IO.Path.GetTempFileName();
	XmlTextWriter writer = new XmlTextWriter(tempfile, Encoding.Unicode); 
	writer.WriteStartDocument(false);
	writer.WriteStartElement(XML_ROOT_ELEMENT);
	using (TextReader reader = new StreamReader(filename,true))
	{
		string line;
		while ((line = reader.ReadLine())!=null)
		{
			if (headerRow) 
			{
				headerRow = false;
			}
			else
			{
				ProcessCsvRow(line, ref writer);
			}
		}
	} 
	writer.WriteEndElement();
	writer.WriteEndDocument();
	writer.Close(); 
	XmlDocument result = new XmlDocument();
	result.Load(tempfile);
	System.IO.File.Delete(tempfile);
	return result;
}


Thanks in advance,

JB
AnswerRe: Character encoding when reading a text file of unknown encoding, to create an XML file Pin
Luc Pattyn24-Aug-10 9:52
sitebuilderLuc Pattyn24-Aug-10 9:52 
GeneralRe: Character encoding when reading a text file of unknown encoding, to create an XML file Pin
JohnLBevan24-Aug-10 22:33
professionalJohnLBevan24-Aug-10 22:33 
QuestionStrange order of events in ListView with MultiSelect set to false Pin
crypto_rsa24-Aug-10 6:28
crypto_rsa24-Aug-10 6:28 
AnswerRe: Strange order of events in ListView with MultiSelect set to false Pin
Ravi Bhavnani24-Aug-10 8:17
professionalRavi Bhavnani24-Aug-10 8:17 
AnswerRe: Strange order of events in ListView with MultiSelect set to false Pin
DaveyM6924-Aug-10 10:16
professionalDaveyM6924-Aug-10 10:16 
GeneralRe: Strange order of events in ListView with MultiSelect set to false Pin
crypto_rsa24-Aug-10 21:37
crypto_rsa24-Aug-10 21:37 
GeneralRe: Strange order of events in ListView with MultiSelect set to false Pin
johannesnestler24-Aug-10 23:05
johannesnestler24-Aug-10 23:05 
AnswerRe: Strange order of events in ListView with MultiSelect set to false Pin
DaveyM6924-Aug-10 10:41
professionalDaveyM6924-Aug-10 10:41 
GeneralRe: Strange order of events in ListView with MultiSelect set to false Pin
crypto_rsa25-Aug-10 1:12
crypto_rsa25-Aug-10 1:12 
QuestionEditable datagridview Pin
saqib8224-Aug-10 5:37
saqib8224-Aug-10 5:37 
AnswerRe: Editable datagridview Pin
dan!sh 24-Aug-10 6:00
professional dan!sh 24-Aug-10 6:00 
GeneralRe: Editable datagridview Pin
saqib8224-Aug-10 6:07
saqib8224-Aug-10 6:07 
GeneralRe: Editable datagridview Pin
dan!sh 24-Aug-10 6:24
professional dan!sh 24-Aug-10 6:24 
GeneralRe: Editable datagridview Pin
saqib8224-Aug-10 6:39
saqib8224-Aug-10 6:39 
AnswerRe: Editable datagridview Pin
Mada Naga Sankar25-Aug-10 19:38
Mada Naga Sankar25-Aug-10 19:38 
Questionproblem with invoke method. it says cannot call invoke on a control until the window handle has been created Pin
prasadbuddhika24-Aug-10 4:59
prasadbuddhika24-Aug-10 4:59 
AnswerRe: problem with invoke method. it says cannot call invoke on a control until the window handle has been created Pin
Luc Pattyn24-Aug-10 5:32
sitebuilderLuc Pattyn24-Aug-10 5:32 

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.