|
Can your console output the character even if it is read correctly? If your console code page does not support it your program won't display it.
UTF8 is multibyte, so your read operation might split the byte stream in the middle of a character. Create a StreamReader with Encoding.UTF8 to avoid having to deal with this manually.
Edit: Are you sure your file is actually UTF-8 encoded?
|
|
|
|
|
Hello,
First, thanks for youre time!
Actually I started by using a StreamReader, with the result that the complete line was there but without the '²' character.
Any other suggestions?
All the best,
Martin
|
|
|
|
|
First of all, check the source file (in my experience the most likely error). The character should be encoded with the byte sequence C2 B2.
As a quick hack to test it rename the input file so it has a bin extension and load it in Visual Studio - you should now see the byte content in a hex format.
|
|
|
|
|
Hmm,
I did the test with following result "B2" and no character is shown.
When I open it with the "TotalComander" Bin style, it's also "B2" but the '²' is shown.
So uses UTF8 really multibyte, or only for special characters?
Thanks again for your time and patiance.
All the best,
Martin
|
|
|
|
|
UTF-8 use more than one byte for anything over Unicode character 127. Some refers to these as special, others refer to English characters as special.
|
|
|
|
|
|
Hello,
It really looks like the file isn't really UTF8. (It's a XML file with a discribtion that says its UTF8 formated )
But I don't know wich encode I have to use.
Is there a way to find this out?
All the best,
Martin
|
|
|
|
|
Yes, this is seen before - it's an invalid XML file, a lot of programs spit those out.
A fair guess is the local ANSI codepage whereever the file was saved. For most Western European languages, this would be the Windows codepage 1252 (or use Encoding.Default if the encoding is the same on the machine reading and writing the file).
|
|
|
|
|
Bulls Eye
Thanks very much!
I'm now using the GetEncoder method, and "Windows-1252" as the parameter.
All the best,
Martin
|
|
|
|
|
I NEED TO USE the MaskedTextBox but i have 4 problem with it
1- my format 2ill be it that style(number1,number2)
first i don't know how may digits will be in number1
number2 will have only 3digit
i don't know how to make number1 with no fixed digits
2-i need the style that he make in textbox like(_____,____)not to appear because my client know how they will write the numbers but i used that control for validation
3- if i didn't right any digit in numer1 it add automitc 0
4- in number2 if i write 33 it appear like that ,330
plz answer me tody i wantto finish that task today
ma_refay
|
|
|
|
|
Hi,
I would like a simple c# function that causes a page to wait for a predetermined length of time before closing but am unsure of what to search for so I keep returning irrelivant results. Please can someone help.
many thanks
mark
|
|
|
|
|
Use Timer in Windows Forms. If event "tick" comes, then close your form.
|
|
|
|
|
You could always use sleep.
|
|
|
|
|
i need to write textbox in customformat like "111,111" how to execute that format {windows application c#2005)
ma_refay
-- modified at 6:06 Tuesday 20th February, 2007
|
|
|
|
|
|
If you're using Framework >2.0 you can use the MaskedTextBox control.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
i want to prevet textbox from store characters & numbers in it after some conditional for example if textbox contain "," after 3letters after "," prevent to add any chars to text
how??????
ma_refay
|
|
|
|
|
Hello,
You need to handle the KeyPressed event or override the OnKeyPessed in your TextBoxControl which inherits from TextBox.
there you have to compare the "e.KeyChar" with the "," or ".".
if (e.KeyChar == ',')
{
if(this.Text.IndexOf(',') > -1)
{
e.Handled = true;
}
}
Hope that helps!
All the best,
Martin
|
|
|
|
|
If you have many different combinations to cater for, then patterns and regular expressions may also help. I think I have once used regular expressions for similar problem in the past...
Ashvin Gunga
|
|
|
|
|
20 Feb 2007
I want to gather data from this page:
http://moneycentral.msn.com/investor/StockRating/srstopstocksresults.aspx?Score=10
and process it in C#.
The problem is the page content is loaded via scripts (I think) and the page's .html source does not contain the data. So my initial idea of getting and processing the page's .html source won't work.
Manually typing Control-A Control-C and pasting into a text document would work, but I'd prefer an automated solution.
A. Is there an easy way to actually handle the scripts from within C# (or .NET in general)?
OR
B. I've never done control of another program through C#, although I understand that .NET allows this. Can my browser be controlled to send me the text or save it to a file?
OR
C. Perhaps a FireFox plug-in should be written? (I've never written a plug-in before, either.)
Suggestions would be appreciated.
Thanks,
Mark
|
|
|
|
|
Try System.Net.Webrequest .. to create a request for the page, and if you're not sure of a correct response, use WebResponse.GetResponseStream() to process the response
Patt
|
|
|
|
|
Thanks for the try, but this just retrieves the general page setup and the scripts themselves... none of the data that is displayed on the page is in what is obtained. (I do really appreciate the pointer to these functions, however. I need them for another project I have in mind!)
Still looking for a solution.
Mark
|
|
|
|
|
Maybe you can be a little more specific about the "data" you are looking for. I'm assuming you need the items displayed in the 6 column result table on the page ?
Patt
|
|
|
|
|
Sounds like it uses AJAX to retrieve the data?
Maybe you could see what URL is being called by the script from the page source?
|
|
|
|
|
The information that I want is the large table of Stock related information.
I tried looking at links in the .html source, and the one that I suspect provides the content gave an "invalid" reply from a database. Perusing the scripts (which I do not know how to read) it appears the script and the database may exchange some password-like information before allowing the query.
Still looking for a way to capture the text that the Web browser has already obtained, without doing a manual copy and paste to a text file.
Mark
|
|
|
|